- 1
Im in lists...
Im doing the solo course thing and im in lists. Anyway it keeps making weird answers. Apparently if you make a list of 5 numbers, 1-5, and in the next line it says num: [3], then apparently the answer would be 2 since 5=0, 4=1, 3=2, 2=3, and 1=4?
4 Respostas
+ 2
I'm not good understanding what you're trying to describe, but... if you define a list as:
a = [1,2,3,4,5]
... then you've got:
a[0] == 1
a[1] == 2
a[2] == 3
a[3] == 4
a[4] == 5
... as indexes of list items start at zero, not at one ^^
0
So if it counts from 1-6 instead of 5 in a list and it selects num: 4 for example, would 6 =0 from then on out and it counts down from 6 and up from 0?
0
The indexes start from 0, no matter what are the elements.
[5, 4, 3, 2, 1]
0, 1, 2, 3, 4
[6, 5, 4, 3, 2, 1]
0, 1, 2, 3, 4, 5
0
Thanks doods