Raising Custom Exceptions
Mon 10 August 2026
def validate_age(age):
if age < 0:
raise ValueError("Age cannot be negative")
validate_age(-5)
Score: 5
Category: chapter7_custom_exceptions
def validate_age(age):
if age < 0:
raise ValueError("Age cannot be negative")
validate_age(-5)
Score: 5
Category: chapter7_custom_exceptions