I was looking at making a maze game in python, and on an online tutorial there was a
list that seemed to be indexed twice. I understand that
list[x] pulls the
x item from that list, but I don’t know how double brackets like
Does it pull the
y of the
Can someone please tell me what it’s called so I can further research it?
Yes, you are correct. Imagine we have a list with sublists in them. For example:
a = [[1,2,3],[4,5,6],[7,8,9]]
If we want to access one of those numbers, let’s say 6, and assign it to the variable b, we would select it like this:
b = a
The one means the 2nd element in the list a and the two would mean the 3rd element in the list we selected from a.
I hope this solves your problem and happy coding!
Answered By – Afzain123