Skip to content
BENIBIX Learn

Runtime Error

Development🧩 Programming ConceptsErrors

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

A runtime error happens while the program is running. The code is written right, so it starts. Then it hits something it cannot do. Dividing by zero, opening a file that is not there and using a null value are common causes. The program stops at that line and shows a message. Often it only happens with certain input, so it can hide for a long time.

Example code

python
>>> scores = []
>>> sum(scores) / len(scores)
ZeroDivisionError: division by zero
The code is fine, but an empty list makes it divide by zero.

Common mistake

Testing only with normal input. Try empty lists, zero, missing files and very long text too.

Key takeaways

  1. 1
    Starts, then stops. The program runs until it hits the problem.
  2. 2
    Depends on input. Some values trigger it; most do not.
  3. 3
    Test the edges. Empty, zero and missing find it early.

Compare

Learn it properly