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

is this wrong?

question was: "was is the output of this code? list = [1, 1, 2, 3, 5, 8, 13] print(list(list[4])" The code means that the item with the index == 4 in the list will be printed, right? I answer therefore that the output of the code would be "5". But the system tells me that that is the wrong answer, and when I ask for a hint (after five tries....) it tells me the right answer is "8". If I am not mistaken, in the list: - first item, with index 0, is 1 - second item, with index 1, is the second 1 - third item, with index 2, is 2 - fourth item, with index 3, is 3 AND - fifth item, with index 4, is 5. --> which was my answer. What is it that I am not getting right?

29th Oct 2018, 5:10 PM
Emma
1 Answer
+ 2
Are you sure thats is not this the expression print( list[list[4]] ) ??
29th Oct 2018, 5:20 PM
KrOW
KrOW - avatar