Read Python Like a Pro / Errors and help
Lesson 6 of 10
Reading error messages
Errors aren't failures, they're clues. Python prints a traceback: the last line says what went wrong and the line just above shows where.
Key points
- Read the last line first
- Note the file and line number
- Then read the code on that line
Traceback (most recent call last):
File "app.py", line 3, in <module>
print(score + 5)
TypeError: can only concatenate str (not "int") to strYour turn
Fix the error above by converting score with int(score) before adding. Then make a different error on purpose and read its message.
Quiz · +10 XP
What caused this error?
Log in to save progress and earn XP.