print first some element of list python code example
Example 1: find the first element in phython list
Alist = ['Sun','Mon','Tue','Wed','Thu']
print("The given list : ",Alist)
print("The first element of the list : ",Alist[0])
print("The last element of the list : ",Alist[-1])
Example 2: python get first n elements of list
l = [1, 2, 3, 4, 5]
print(l[:3])