+ 1

I don't understand how the output displays 3??

This is a question I got during a challenge and I get it wrong every time... lis = [1,9,3,5,8,3,3,6,1,8] print(lis[lis[7]]) https://code.sololearn.com/ckiu9FlQHndN/?ref=app

24th Oct 2022, 6:30 PM
Bezu Tadesse
Bezu Tadesse - avatar
1 Odpowiedź
+ 5
lis[7] will get you the number at index 7 (which is 6) now we can simplify lis[lis[7]] to lis[6] the 6th index in lis is 3! I hope this help :)
24th Oct 2022, 6:33 PM
Apollo-Roboto
Apollo-Roboto - avatar