find first element of array in python code example
Example 1: how to remove first element in array php
<?php
$stack = array("orange", "banana", "apple", "raspberry");
$fruit = array_shift($stack);
print_r($stack);
?>
// Array
// (
// [0] => banana
// [1] => apple
// [2] => raspberry
// )
Example 2: how to find the index of a value in an array in javascript
var list = ["apple","banana","orange"]
var index_of_apple = list.indexOf("apple")
Example 3: python get first element in a list
test_list = [1, 5, 6, 7, 4]
print ("The original list is : " + str(test_list))
res = [ test_list[0], test_list[-1] ]
print ("The first and last element of list are : " + str(res))