Editor

Fix All the Bugs

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 lesson

This code has THREE bugs (one per section). Fix all of them so the output is:

Student: Alice
Grade: 85
Passed: True
# Bug 1: Something wrong with the variable name
student_name = 'Alice'
print(f'Student: {student_Name}')
# Bug 2: Something wrong with the type
grade = '85'
print(f'Grade: {grade + 0}')
# Bug 3: Something wrong with the comparison
passed = grade >= 60
print(f'Passed: {passed}')

More error messages exercises

All Python exercises · 50 practice problems · Control Flow quiz