+ 1

Question about lists

I am learning python and one of the questions said something along the lines of [1, 1,2,3,4,5,8] What is the numbers (4) and it counted the second number as zero. Why is this? If I am incorrect and missed counted or something question still stands do you count the 1 twice or once because they are the same number?

20th Mar 2019, 10:15 PM
CodingGirl3
CodingGirl3 - avatar
1 ответ
+ 3
If I understand your question correctly (I'm guessing your looking for the index or position something is within the array), arrays in Python start counting at 0 (so in this case, the first 1 would have an index of 0, the second would have an index of 1, the 2 would have an index of 3, etc.) It's a little confusing at first, but it gets easier with time d:
20th Mar 2019, 10:46 PM
Faisal
Faisal - avatar