just wanted to get an opinion on my current although very thin skeleton of my text-based RPG I am creating within Python.
class Item(object):
def __init__(self, item):
if(key in Loot):
self.item = Inventory[key]
else:
self.item = None
print('No loot obtain for that decision')
def get_item(self):
return self.item
def item(self):
return str(self.item)
class Inventory(object):
def __init__(self):
self.inventory = []
def add_item(self, item):
self.inventory.append(item)
return self.inventory
def added_loot(self):
print('Congrats, you have obtained a/an' + str(self.item))
My current code displays my inventory dictionary as values when I run the added_loot method. I wanted to see if there was any way I can remake this code and use keys in my dictionary as my self.inventory and shuffle those? So when I print out str(self.item) it will print out the actual key and not the value within the dictionary.