+ 3

What's happening for print (things[2][2])'s output?

number = 3 things = ["string", 0, [1, 2, number], 4.56] print(things[1]) print(things[2]) print(things[2][2]) output- >>> 0 [1, 2, 3] 3 >>>

29th Sep 2018, 11:54 AM
partha
partha - avatar
5 Réponses
+ 6
it prints the 3rd element of the list, which is the 3rd element of things. it wont function with the other elements of things, as they are not containers like [1, 2, 3]
29th Sep 2018, 12:08 PM
Kevin Dietrichstein
Kevin Dietrichstein - avatar
+ 3
things[2] is a list, so things[2][2] will be the value of the third item in the list. k = things[2] print(k[2]) >>> 3
29th Sep 2018, 12:07 PM
gil gil
+ 3
partha i think you are PUBG player.🤗😀😀🤠🤠
29th Sep 2018, 4:09 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
thanks Kevin and gil
29th Sep 2018, 1:25 PM
partha
partha - avatar
0
the answer is idk
20th Dec 2018, 9:25 PM
Ryan