0

python lists

number = 3 things = ["string", 0, [1, 2, number], 4.56] print(things[1]) print(things[2]) print(things[2][2]) why does print(things[2][2]) becomes 3?

5th May 2020, 1:30 PM
Lim Long Teck
Lim Long Teck - avatar
2 ответов
+ 1
Thing [2][2] means find the value assigned as [2]to in this case it is [1,2,number]->which number is assigned as “3” then the second will run to find the value assigned as[2] in the first one then it will print 3
22nd Aug 2020, 8:26 AM
Kalid Mohammedsherif
Kalid Mohammedsherif  - avatar
0
Because you have assigned 3 to number
5th May 2020, 1:32 PM
Abhay
Abhay - avatar