Skip to content

Instantly share code, notes, and snippets.

@joetechem
Created February 15, 2017 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joetechem/ae77e9d1ae3f8dce477bfa3b76d854c8 to your computer and use it in GitHub Desktop.
Save joetechem/ae77e9d1ae3f8dce477bfa3b76d854c8 to your computer and use it in GitHub Desktop.
dictionaries: dictionary of similar objects
# 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