bugfix, new check on cat with money, and big update incoming!

This commit is contained in:
2026-04-20 17:04:23 -04:00
parent 1580ad9e6e
commit 57d2797160
2 changed files with 4 additions and 2 deletions

View File

@@ -1,9 +1,10 @@
class Cat: class Cat:
def __init__(self, name, traits, money=25, inventory={}): def __init__(self, name, traits, money=25, inventory=None):
self.name = name self.name = name
self.traits = traits self.traits = traits
self.money = money self.money = money
self.inventory = inventory self.inventory = inventory
self.inventory = inventory if inventory is not None else {}
def to_dict(self): def to_dict(self):
return vars(self) return vars(self)

View File

@@ -183,8 +183,9 @@ def house(cat: Cat):
): ):
case "Check on your cat": case "Check on your cat":
print( print(
f"{cat.name} - a {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes" f"{cat.name} - a {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes."
) )
print(f"You have ${cat.money}.")
case "Pet your cat": case "Pet your cat":
pet(cat) pet(cat)
case "Feed your cat": case "Feed your cat":