python list get first 5 elements code example
Example 1: python first n elements of list
a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
Example 2: get first element of list python
some_list[0]
a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
some_list[0]