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