0

quiz 2

list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) answer is 8 but i think it is 5 not sure whats wrong with what im doing

13th Aug 2018, 7:52 PM
Tyler Tomlin
Tyler Tomlin - avatar
7 Answers
0
The answer is 8. Don't forget list begin at index 0... So here: list[4]=5 list[5]=8
13th Aug 2018, 8:02 PM
Théophile
Théophile - avatar
0
its [4] though not [5]
13th Aug 2018, 8:03 PM
Tyler Tomlin
Tyler Tomlin - avatar
0
list[0]=1 list[1]=1 list[2]=2 list[3]=3 list[4]=5
13th Aug 2018, 8:05 PM
Théophile
Théophile - avatar
0
think i need to spend more time on the lessons before the quiz cause im not sure list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]]) thats the question right so list = [1, 1, 2, 3, 5, 8, 13] 0 1 2 3 4 5 6 print(list[list[4]]) so doing that it should be 5 for the answer but the quiz said wrong i put the question in playground and it tells me 8 is the answer i must be missing something
13th Aug 2018, 8:08 PM
Tyler Tomlin
Tyler Tomlin - avatar
0
what ever im doing wrong i just dont c it i'll go back and do the lessons before maybe ill figure it out
13th Aug 2018, 8:17 PM
Tyler Tomlin
Tyler Tomlin - avatar
0
First, you take the value of the 4th index of the list (=5) list[4]=5 Then, you take the value of the 5th index of the list (=8) list[list[4]]= list[5]=8 Resume: You take the value of the value of the 4th index!
13th Aug 2018, 8:18 PM
Théophile
Théophile - avatar
0
o ok cool ty
13th Aug 2018, 8:24 PM
Tyler Tomlin
Tyler Tomlin - avatar