Created
February 15, 2017 18:24
-
-
Save joetechem/ae77e9d1ae3f8dce477bfa3b76d854c8 to your computer and use it in GitHub Desktop.
dictionaries: dictionary of similar objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 2.7 | |
# example from Python Crash Course by Eric Matthes | |
# you can store different kinds of information about one object in a dictionary, | |
# you can also use a dictionary to store one kind of information about many objects. | |
# Let's say we wanted to poll a number of people and ask them what their favorite programming language is. | |
# A dictionary can be useful for storing the results of a simple poll: | |
favorite_languages = { | |
'jen', : 'python', | |
'sarah': 'c', | |
'edward': 'ruby', | |
'phil': 'python', | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment