+ 1
indexes in dictionaries
I'm sure I've read somewhere you can't index a dictionary the same way you can a list or when you index a range. maybe they just meant the syntax is different. besides that the norm in python is to count from zero, so that raises the question whether when specifically talking about indexes in ranges/dict/list etc. that you start from one. some clarification would be nice
3 Respostas
+ 3
With dictionnaries, instead of accessing a value with an index, you use a key.
ages = {"Dave":24, "Mary":42, "John":58}
print(ages["Dave"])
+ 2
If the answer you were looking for is different from the one I gave you, feel free to share.
+ 1
I've just done a bunch of testing in playground and researched a bit and it answered my questions. Thankyou for your reply