+ 1
Python list
I have a little trouble understanding this part. list = [ 1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) Answer is 8: How do we arrive at 8👀
5 ответов
+ 6
Indexes are from 0 so list[4] evaluate to 5 so you get list[5]. Index 5 is 8. (as index 0 is 1 in your list, index 1 is 1, index 2 is 2, index 3 is 3, index 4 is 5 and index 5 is 8).
+ 3
It's 8, because list [4] = 5, next evaluation is list [5] which is 8. Hope it helps you.
+ 2
Oo, yeah i see now😁😁. Thanks guys . I feel stupid. Appreciate the help
+ 1
washie mugo , you are welcome 😉
0
This is one of the worst ways to iterate a list, I am not sure why SoloLearn puts these out there as they make no sense and don't really teach. Just my opinion