Skip to content

Instantly share code, notes, and snippets.

@joetechem
Created February 21, 2017 22:38
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/b0bbd762e11fc548dbe7438b4c144bef to your computer and use it in GitHub Desktop.
Save joetechem/b0bbd762e11fc548dbe7438b4c144bef to your computer and use it in GitHub Desktop.
more nesting
# Python 2.7
# Example from Python Crash Course
# Here's another example of nesting a list inside of a dictionary
# looking at our previous example of a dicitonary of similar objects
favorite_languages = {
'jen': ['python', 'ruby'],
'sarah': ['c'],
'edward': ['ruby', 'go'],
'phil': ['python', 'haskell'],
}
for name, languages in favorite_languages.items():
print("\n" + name.title() + "'s favorite languages are:")
for language in languages:
print("\t" + language.title())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment