June 2017
Beginner
320 pages
7h 37m
English
You are now going to learn about the Dictionary data structure in Python. A Dictionary (or dict) is a way to store data just like a list, but instead of using only numbers to get the data, you can use almost anything. This lets you treat a dict like it’s a database for storing and organizing data.
Let’s compare what dicts can do to what lists can do. You see, a list lets you do this:
Exercise 39 Python Session
>>> things = ['a', 'b', 'c', 'd']>>> print(things[1])b>>> things[1] = 'z'>>> print(things[1])z>>> things['a', 'z', 'c', 'd']
You can use numbers to index into a list, meaning you can use numbers to find out what’s in lists. You should know this about lists ...
Read now
Unlock full access