Created
August 9, 2016 03:08
-
-
Save Gwith/a984ebd4843435b7aee1646f3ee9db7a 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
| inventory = {'gold coin': 42, 'rope': 1} | |
| addedItems = ['gold coin', 'dagger', 'gold coin', 'gold coin', 'ruby'] | |
| for item in addedItems: | |
| if item in inventory: | |
| inventory[item] += 1 | |
| else: | |
| inventory[item] = 1 | |
| print(inventory) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment