Quick actions

cmd+k|ctrl+k

Navigation

Languages

Cat-OOP

Snippet info

Language

Python

Visibility

public

Author

udditgupta

Created

2025-11-10T16:15:54.523708Z

Updated

2025-11-10T16:15:56.815472Z

#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.')




INFO