only first 5 terms of list python code example
Example 1: python first n elements of list
a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
Example 2: python print top 5 results of array
#print first 10 elements in list
print(mylist[:10])
a=list((1, 2, 3))
n=1
a[:n]
output:
[1]
#print first 10 elements in list
print(mylist[:10])