I still can't figure how we arrived at this print(things[2][2]) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

I still can't figure how we arrived at this print(things[2][2])

clarification on the example question

29th Jan 2017, 5:41 PM
Dominic Monyoncho
Dominic Monyoncho - avatar
2 Answers
+ 6
The double use of [ ] means that we are calling a list in a list. The first [ ] is the index of the "master" list. This returns an internal list, for which the second [ ] then calls the element at that index
7th Feb 2017, 6:34 PM
Bart Saaiman
Bart Saaiman - avatar
+ 1
Please check this code to understand the mechanism. l = [45,[1,2,3],['a','b']] print (l[1]) print (l[1][0]) print (l[1][1]) print (l[1][2])
12th May 2018, 8:10 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar