How result this code?Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How result this code?Python

list = [1,1,2,3,5,8,13] print(list[list[4]]) result - 8, if list[5] its - result 5 (not 8)in python i write second LIST and i get result 8 .How???

25th Feb 2017, 8:13 AM
Mr UnFinick
Mr UnFinick - avatar
2 Answers
+ 2
because list[4] = 5(not 4) and list[5] = 8
25th Feb 2017, 8:23 AM
Menghout Chhea
Menghout Chhea - avatar
+ 2
@Satyam66: Yes, you can have a variable called 'list' in Python, it's not a reserved keyword ;)
25th Feb 2017, 8:55 AM
visph
visph - avatar