Aug-30-2018, 04:12 AM
This is a snippet of my playercharacter class, specifically the inventory which later calls Weapon which is another class with a list of weapons and individual stats. I am attempting to have user input select one of the weapons from the inventory specifically, then print out the details of the weapon, but am having difficulties coming up with the logic for it. Can anyone assist me in doing so?
def getinventory(self): for object in self.inventory: print object.getname() choice = raw_input("""Do you wish to look at any of the items? """) if choice == 'yes' or choice == 'y': choice = raw_input("""Which item? """) if choice == object.name in self.inventory: object.__str__(choice)