Stage 1 · Lesson 5 of 9
Reading tracebacks and debugging
Errors are information, not failure. When Python crashes it prints a , a report of what went wrong and where. Read it from the bottom up.
The last line names the (the kind of error), such as TypeError or KeyError, with a message. The lines above show the file and line where it happened, and the chain of calls that led there. Most beginner bugs are fixed by reading that last line slowly.
Sometimes there is no error but the output is wrong. Then check your assumptions: print the values just before the suspicious line. Better still, set a breakpoint in your editor, a marker where the program pauses, and step through line by line while watching the variables.
Learn this now, because from here on you will spend more time reading errors than writing new code.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Python Fundamentals
Design Gurus · Beginner · $50
Beginner Python with an in-browser exercise after nearly every lesson
- CourseFreeCS50's Introduction to Programming with Python
Harvard University · Beginner
Free Harvard course whose weekly problem sets make you write real programs