bugfix, new check on cat with money, and big update incoming!
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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":
|
||||||
|
|||||||
Reference in New Issue
Block a user