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

  1. Meet Alex Medium
  2. Rectangle area Easy
  3. Basic math Easy
  4. Powers of two Easy
  5. Leftover remainder Easy
  6. Celsius to Fahrenheit Easy
  7. Simple interest Easy
  8. Test average Easy
  9. Quotes inside quotes Medium
  10. Counting up Easy
  11. Circle area Easy
  12. Sharing into groups Easy
  13. Sales report Easy
  14. Report card Easy
  15. Shouting text Easy
  16. Compound interest Easy
  17. Comparing numbers Easy
  18. Perimeter Easy
  19. x, y and z Easy
  20. BMI calculator Easy
  21. Floor division Easy
  22. Miles away Easy
  23. Tiny and huge numbers Easy
  24. Sales tax Easy
  25. And, or, not Easy
  26. Age in days Easy
  27. First and last letters Easy
  28. Test percentage Easy
  29. Text to number Easy
  30. Miles per gallon Easy
  31. Shortcut operators Easy
  32. Box volume Easy
  33. Rounding pi Easy
  34. Work week Easy
  35. Hexadecimal Easy
  36. Sale price Easy
  37. Octal and binary Easy
  38. Electricity bill Easy
  39. Absolute value Easy
  40. Pizza split Easy
  41. Power order Easy
  42. Loan payment Easy
  43. Seven operators Easy

Punctuation, indentation & keywords 12

  1. Ride check Easy
  2. Unfinished score Easy
  3. Game over? Easy
  4. Flat function Easy
  5. Wandering line Easy
  6. Shouting keywords Easy
  7. Typo countdown Medium
  8. Lucky number Medium
  9. Where's the bracket? Medium
  10. Squashed together Medium
  11. Weather report Medium
  12. Boss: speed limit Hard

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

  1. Sunny or rainy? Easy
  2. Tip calculator Easy

Common crashes 15

  1. Too early Easy
  2. Case matters Easy
  3. Scroe Easy
  4. Roll the dice Easy
  5. Text plus number Easy
  6. Next birthday Medium
  7. Rename the hero Medium
  8. Who broke max? Medium
  9. The last item Easy
  10. Price check Medium
  11. Push it Easy
  12. Where did my player go? Medium
  13. Average of nothing Medium
  14. Point scorer Hard
  15. 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.

Variables, input, math & print 1

  1. Full name Easy

Wrong answers 12

  1. Count to ten Easy
  2. Old enough Easy
  3. Treasure total Easy
  4. Biggest number Medium
  5. Rounded down Medium
  6. High score table Medium
  7. Which way? Medium
  8. Temperature converter Medium
  9. Countdown that never ends Medium
  10. Off the edge Hard
  11. Disappearing enemies Hard
  12. Yes, YES, yes Easy