Answers for "how to print the first five items in a list"

7

python first n elements of list

a=list((1, 2, 3))
n=1
a[:n]

output:
[1]
Posted by: Guest on October-15-2020

Code answers related to "how to print the first five items in a list"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language