Fix the TypeError
Beginner · Fix the bug · from How to Read Python Error Messages and Fix Common Bugs
From the lesson: How to Read Python Error Messages and Fix Common Bugs
When beginners see a red error message, their first instinct is panic. The screen fills with scary-looking text, and they think they broke something badly. But here's the truth: error messages are your best friend. They tell you exactly what went wrong and where.
Read the lessonThis code has a TypeError. Fix it so it prints:
Your total is $37.5price = 12.5
quantity = '3'
total = price * quantity
print(f'Your total is ${total}')
More error messages exercises
- Fix the SyntaxErrorBeginner
- Fix the NameErrorBeginner
- Fix the IndexErrorBeginner
- Fix the ValueErrorBeginner
- Fix All the BugsBeginner
All Python exercises · 50 practice problems · Control Flow quiz