0

N3 - Mistake

number = 3 things = ["string", 0, [1, 2, number], 4.56] print(things[1]) print(things[2]) print(things[2][2]) Result: >>> 0 [1, 2, 3] 3 >>> things[2][2] is number not 3 :)))

19th Jan 2017, 11:15 PM
Tazo Qitiashvili
Tazo Qitiashvili - avatar
2 odpowiedzi
+ 1
number is a variable. number = 3. when the print statement evaluates the variable number, it prints 3, so 3 is correct. if your list were as follows: things = ["string", 0, [1, 2, 'number'], 4.56] then the output would be 'number'. If you are interested, try running this code in the code playground, IDLE or a python interpreter. Step through the code as it is running and inspect the variables. That will help you see what is going on.
20th Jan 2017, 1:20 AM
M King
M King - avatar
0
3 it's correct since you've assigned that value to the number variable
19th Jan 2017, 11:18 PM
Davide Corbelletto
Davide Corbelletto - avatar