Last active
August 24, 2021 21:31
-
-
Save richardpascual/12a71c18527366415099b064ed2e61e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Example 1 | |
drinks = ["espresso", "chai", "decaf", "drip"] | |
caffeine = [64, 40, 0, 120] | |
zipped_drinks = zip(drinks, caffeine) | |
drinks_to_caffeine = {key:value for key, value in zipped_drinks} | |
print(drinks_to_caffeine) | |
# Codecademy | |
# Example 2 | |
songs = ["Like a Rolling Stone", "Satisfaction", "Imagine", "What's Going On", "Respect", "Good Vibrations"] | |
playcounts = [78, 29, 44, 21, 89, 5] | |
plays = {key:value for key, value in zip(songs, playcounts)} | |
print(plays) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment