python first element in arraty code example
Example 1: python first n elements of list
a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
Example 2: how to find first element in a list python
an_array = [1,2,3,4,5]
first element = an_array[0]
a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
an_array = [1,2,3,4,5]
first element = an_array[0]