0
number = 3 things = ["string", 0, [1, 2, number], 4.56] print(things[1]) print(things[2]) print(things[2][2])
print(things [2][2]) what does the second [2] indicate?
2 odpowiedzi
+ 5
The element at things[2] is a list. things[2][2] indexes the 3rd element of this list in the things-list
+ 1
Say that the list things is [[1, 2], [3, 4]] for an example.
To access things[1] would return [3, 4], because [3, 4] is the second element in the list, even though it is a list itself.
Accessing things[1][1] would return 4, because [1][1] basically means the 1st index of the 1st index in things.
Hope this helps, if it still doesn't make sense, let me know!