Jan-13-2020, 09:52 PM
__str__ and __repr__ will still work. Just decide what you want to print. As you have been shown above you can define what attributes are printed:
def __str__(self): return "self.item" # will display just the name of the item. def __str__(self): return f"This item is a {self.item}. It attacks for {self.attack} damage!" # Displays a fancy message about item.BTW, it's confusing to use "item" as the name of your Items. How about "name"?
"So, brave knights, if you do doubt your courage or your strength, come no further, for death awaits you all with nasty, big, pointy teeth!" - Tim the Enchanter