Answers for "get first n elements of array python"

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 "get first n elements of array python"

Python Answers by Framework

Browse Popular Code Answers by Language