Basic Custom Exception Example
Mon 10 August 2026
class NegativeValueError(Exception):
pass
def process_value(value):
if value < 0:
raise NegativeValueError("Negative values are not allowed")
process_value(-10)
Score: 5
Category: chapter7_custom_exceptions