Skip to content

Instantly share code, notes, and snippets.

@toonarmycaptain
toonarmycaptain / FantasyGameInventory.py
Created July 27, 2017 20:07
Automate the Boring Stuff Chpt 5 - Fantasy Game Inventory
stuff = {'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, 'arrow': 12}
#def displayInventory(inventory):
# total_items = 0
# for item in inventory:
# print(str(inventory[item])+' '+item)
# total_items += inventory[item]
# print("Total number of items: "+str(total_items))
# This worked but I like the following better: