Quick actions

cmd+k|ctrl+k

Navigation

Languages

Exercise: Cats Everywhere

Snippet info

Language

Python

Visibility

public

Author

fpuleano

Created

2023-04-26T16:16:03.39491Z

Updated

2023-04-26T16:51:34.598984Z

class Cat:
    species = 'mammal'
    def __init__(self, name, age):
        self.name = name
        self.age = age
        
mycat1 = Cat('boots',2)
mycat2 = Cat('lucy',5)
mycat3 = Cat('tom',7)

def old_cat(cat1, cat2, cat3):
    if cat1.age > cat2.age and cat3.age:
        old_cat = "the oldest cat is", cat1.name, "with age of", cat1.age
    if cat2.age > cat1.age and cat3.age:
        old_cat = "the oldest cat is", cat2.name, "with age of", cat2.age, "years"
    else:
         old_cat = "the oldest cat is", cat3.name, "with age of", cat3.age, "years"
    print(old_cat)
        
    
    
INFO