Square bracket notation¶
Dict¶
When you need to get a value in a dict, you pass in the key (the 'word' using the dictionary analogy)
Then Python will fetch what the corresponding value is.
Lists¶
You can think of lists like special dictionaries.
The OG dictionary 😎
That's why they both use square brackets (my guess ¯\(ツ)/¯)
is similar to this dictionary
Double square brackets¶
A list can't be a key for a dictionary (I'll explain that later)
if you could though, then it would look like this
Which is the same as
Last update:
2023-04-24