-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCats-Everywhere-Exercise
54 lines (44 loc) · 2.32 KB
/
Cats-Everywhere-Exercise
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
48
49
50
51
52
53
54
# Given the below class:
class Cat:
species = 'mammal'
def __init__(self, name='None', age=0):
self.name = name
self.age = age
# 1 Instantiate the Cat object with 3 cats
cat1 = Cat('Buckles', 3)
cat2 = Cat('Squishy', 8)
cat3 = Cat('Mr. Bigelsworth', 40)
# 2 Create a function that finds the oldest cat
def cat_age():
catage = [cat1.age, cat2.age, cat3.age]
age = max(catage)
print(f'The oldest cats is {age} years old')
# 3 Print out: "The oldest cat is x years old.".
cat_age()
# x will be the oldest cat age by using the function in #2
/\ /\
| \ / |
| \ / \ / |
| \ /\ / \ / \ / |
| \ ^ / \/ \/ \ ^ / |
| |
/ \
/ \ / \
/ | \ / | \
/ | \ / | \
/ | @\ /@ | \
/ | \ / | \
/ \___/ \___/ \
/ \
/ |\______________________/| \
/ \ | | | | | | | /\ \
/ / \ | | | | | | | / \ \
/ / \ | | | | | | | / \ \
/ / \ \ | | | | | / / \ \
/ \ \ \_|___|___|___|___|__/ / / \
\/\/\/ /\ /\ \/\/\/
/ \ / \
| |
| \____________________/ |
\ | | /
<_________/ \_________>