python lists confusion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python lists confusion

nums = [5, 4, 3, 2, 1] print(nums[1]) the result is 4 , why? can anyone explain?

15th Sep 2017, 3:16 PM
Duma Cristian
Duma Cristian - avatar
2 Answers
0
Oh i figured it out,because in order to get 5 you must print [0] to get the first number
15th Sep 2017, 3:18 PM
Duma Cristian
Duma Cristian - avatar
- 1
array list tuple postion always stars with 0 ends with (total length-1)
15th Sep 2017, 5:43 PM
sayan chandra
sayan chandra - avatar