Exception

Domain: Software Engineering

🎯 Motivation

An error that occurs during execution. In Python: ValueError, TypeError, ZeroDivisionError, etc.

πŸ“‹ Concrete Example

Exception: int(abc) -> ValueError: invalid literal for int(). The code stops unless you handle it: try: int(abc) except ValueError: print(β€˜Please enter a number.’). Handled gracefully.

πŸ”— Analogy

An exception is like a fire alarm - something went wrong, and the program stops unless someone handles it. try/except is the fire drill: you know what to do when the alarm sounds.