Quiz

Reading the Scroll of Errors

When Python crashes, it prints a traceback: the trail of function calls that led to the error. Don't panic. Read it from the bottom up:

  1. The last line names the error type and gives a message.
  2. The line just above it shows where it happened.
  3. Lines further up show who called that code.

Here's one from the Guild's star-counting program:

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    print(average([]))
  File "main.py", line 3, in average
    return total / len(numbers)
ZeroDivisionError: division by zero

What went wrong, and where?