Created
February 21, 2017 22:38
-
-
Save joetechem/b0bbd762e11fc548dbe7438b4c144bef to your computer and use it in GitHub Desktop.
more nesting
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 | |
# 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