+ 1

Shouldn't the answer be 5?(Python 3)

Maybe I'm over-thinking the question, but for this question here: list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) Shouldn't the answer be 5? Instead, I'm getting 8 as the answer. Can someone please explain to me how 8 is the answer?

21st Jun 2019, 8:44 PM
Ty'Keynu McQueen
Ty'Keynu McQueen - avatar
3 ответов
+ 7
print(list[list[4]]) print(list[5]) print(8)
21st Jun 2019, 8:50 PM
voja
voja - avatar
+ 1
No. Notice that the 5 you thought you should get is used to index another value.
21st Jun 2019, 8:51 PM
Seb TheS
Seb TheS - avatar
+ 1
Oh, now it makes a lot of sense to me. Thank you guys so much for the help. I didn't want continue on with my lessons without understanding how that was the answer.
22nd Jun 2019, 6:15 AM
Ty'Keynu McQueen
Ty'Keynu McQueen - avatar