You are on page 1of 1

class Cat:

species = 'mammal'

def __init__(self, name, age):


self.name = name
self.age = age

cat1 = Cat('kat', 2)
cat2 = Cat('kit', 4)
cat3 = Cat('kitty', 6)

def oldest_cat():
age_list = [cat1.age, cat2.age, cat3.age]
x = max(age_list)
print("The oldest cat is " + str(x) + " years old")

oldest_cat()

Other way --

def get_oldest_cat(*args):
return max(args)

print(f"The oldest cat is {get_oldest_cat(peanut.age, garfield.age, snickers.age)}


years old.")

You might also like