a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
l = [1, 2, 3, 4, 5]
print(l[:3])
# Python3 program to extract first and last
# element of each sublist in a list of lists
def Extract(lst):
return [item[0] for item in lst]
# Driver code
lst = [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
print(Extract(lst))
list[0]
an_array = [1,2,3,4,5]
first element = an_array[0]
some_list[0]