Cat-OOP

Run Settings
LanguagePython
Language Version
Run Command
#Given the below class: class Cat: species = 'mammal' def __init__(self, name, age): self.name = name self.age = age # 1 Instantiate the Cat object with 3 cats Cobj = Cat('C1', 10) Cobj2 = Cat('C2', 20) Cobj3 = Cat('C3', 30) # 2 Create a function that finds the oldest cat def oldest_cats(*args): return max(*args) # 3 Print out: "The oldest cat is x years old.". x will be the oldest cat age by using the function in #2 print(f'Oldest Cat is {oldest_cats(Cobj.age, Cobj2.age,Cobj3.age)} years old.')
Editor Settings
Theme
Key bindings
Full width
Lines