0

Error in the Control Structures -> List lecture

This is the code of the section 3/4. Here I believe number has to be either in single or double quotes in order to be a string: number = 3 things = ["string", 0, [1, 2, number], 4.56] print(things[1]) print(things[2]) print(things[2][2]) and this is the output in the lecture which is wrong: >>> 0 [1, 2, 3] 3 >>> I think it has to be: >>> 0 [1, 2, "number"] number >>>

8th Sep 2017, 11:33 AM
George
2 ответов
+ 7
The value of number (as a variable) was inserted, not the string 'number', hence, things contain ["string", 0, [1, 2, 3], 4.56] The output of things[2] would be [1, 2, 3]
8th Sep 2017, 11:49 AM
Hatsy Rei
Hatsy Rei - avatar
0
yes, you are right, I didn't notice the name of the first variable, that's why there aren't quotes there
8th Sep 2017, 12:04 PM
George