-
Notifications
You must be signed in to change notification settings - Fork 2
/
pypet.py
48 lines (37 loc) · 846 Bytes
/
pypet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
Pypet Game
From the tutorial found at:
https://alissa-huskey.github.io/python-class/lessons/tutorial.html
"""
print("Welcome to Pypet!")
cat = {
"name": "Fluffy",
"hungry": True,
"weight": 9.5,
"age": 5,
"pic": "(=^o.o^=)_",
}
mouse = {
"name": "Mouse",
"age": 6,
"weight": 1.5,
"hungry": False,
"pic": "<:3 )~~~~",
}
pets = [cat, mouse]
def feed(pet):
if pet["hungry"] == True:
pet["hungry"] = False
pet["weight"] = pet["weight"] + 1
print("omnomom!!")
else:
print("The Pypet is not hungry!")
for pet in pets:
print()
print("------------------------------")
print("Hello " + pet["name"] + "!")
print(pet["pic"])
print("Weight: " + str(pet["weight"]))
feed(pet)
print("Weight: " + str(pet["weight"]))
print("------------------------------")