Debugging practice
Every program here is broken. Fix the code until all of its tests pass. Real programmers spend a lot of their time doing exactly this.
You can try every problem without an account. Log in or sign up to save your progress and earn achievements.
Syntax errors
Missing colons, brackets and quotes, wrong indentation, misspelled keywords. Python refuses to start until the code is written correctly.
Variables, input, math & print 43
- Meet Alex Medium
- Rectangle area Easy
- Basic math Easy
- Powers of two Easy
- Leftover remainder Easy
- Celsius to Fahrenheit Easy
- Simple interest Easy
- Test average Easy
- Quotes inside quotes Medium
- Counting up Easy
- Circle area Easy
- Sharing into groups Easy
- Sales report Easy
- Report card Easy
- Shouting text Easy
- Compound interest Easy
- Comparing numbers Easy
- Perimeter Easy
- x, y and z Easy
- BMI calculator Easy
- Floor division Easy
- Miles away Easy
- Tiny and huge numbers Easy
- Sales tax Easy
- And, or, not Easy
- Age in days Easy
- First and last letters Easy
- Test percentage Easy
- Text to number Easy
- Miles per gallon Easy
- Shortcut operators Easy
- Box volume Easy
- Rounding pi Easy
- Work week Easy
- Hexadecimal Easy
- Sale price Easy
- Octal and binary Easy
- Electricity bill Easy
- Absolute value Easy
- Pizza split Easy
- Power order Easy
- Loan payment Easy
- Seven operators Easy
Punctuation, indentation & keywords 12
Runtime errors
The code starts, then crashes. Read the error's type and message (NameError, TypeError, IndexError...) to find out why.
Variables, input, math & print 2
Common crashes 15
- Too early Easy
- Case matters Easy
- Scroe Easy
- Roll the dice Easy
- Text plus number Easy
- Next birthday Medium
- Rename the hero Medium
- Who broke max? Medium
- The last item Easy
- Price check Medium
- Push it Easy
- Where did my player go? Medium
- Average of nothing Medium
- Point scorer Hard
- Never-ending factorial Hard
Logic errors
No crash, no error message: the program just gives the wrong answer. Trace what the code really does and find where it goes wrong.