So I am learning python using Learn python the hard way. I am trying to develop a inventory system. The goal is to build this into a class that will be pulled by the room
zbs is correct, you're only changing the value of the pointer to the dict value. However, you're making this way too hard:
#This is the inventory in this room
inventory = {'Miniature Fusion Warhead': 'desk',
'knife':'bed'}
player_inventory = set()
def take(item):
if item in inventory:
print("You picked up the {}".format(item))
player_inventory.add(item)
del inventory[item]
else:
print("That item doesn't exist")
while True:
print('')
print("Inventory: " + ', '.join(player_inventory))
for k,v in inventory.items():
print("You see a {} on the {}".format(k, v))
print("What do you want to pick up?")
ui = raw_input("> ").split()
verb = ui[0]
item = ' '.join(ui[1:])
if verb == 'take':
if item:
print("You take the {}".format(item))
take(item)
else:
print("That item doesn't exist")
else:
print("That's not an action")