🧩Runtime Error
Also known as Run-Time Error, Crash
An error that shows up while the program runs. Some input sets it off.
Think of it like
Think of it like a car that starts fine, then runs out of fuel on the road.
Example
An average function works for weeks, then a class with no scores sends it an empty list. It crashes with ZeroDivisionError.
Why it matters
Runtime errors often reach real users, because they hide until odd input comes along. Testing edge cases finds them first.
Definition
Example code
python
>>> scores = []
>>> sum(scores) / len(scores)
ZeroDivisionError: division by zeroCommon mistake
Key takeaways
- 1Starts, then stops. The program runs until it hits the problem.
- 2Depends on input. Some values trigger it; most do not.
- 3Test the edges. Empty, zero and missing find it early.