Answers for "python get first n items of array"

3

python get first n elements of list

l = [1, 2, 3, 4, 5]
print(l[:3])
Posted by: Guest on June-02-2020
3

how to get first element of array in python

arr = ["cat", "dog", "rabbit"]
first_element = arr[0]
Posted by: Guest on October-01-2020

Code answers related to "python get first n items of array"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language