{"id":3237,"date":"2026-04-22T18:10:10","date_gmt":"2026-04-22T17:10:10","guid":{"rendered":"https:\/\/computingeducationresearch.org\/?p=3237"},"modified":"2026-04-30T15:49:11","modified_gmt":"2026-04-30T14:49:11","slug":"how-do-students-debug-python-programs","status":"publish","type":"post","link":"https:\/\/computingeducationresearch.org\/how-do-students-debug-python-programs\/","title":{"rendered":"How do students debug Python programs?"},"content":{"rendered":"\n

If you were to describe your approach to debugging in one word, what would it be? What about when you were learning to program? In this blog, I\u2019ll report on a research study on how school students debug Python programs and what this tells us about their struggles with fixing errors. This is the first in a mini-series of blogs about my recently completed PhD, which investigated the teaching and learning of debugging in secondary schools.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Why research debugging behaviour?<\/h3>\n\n\n\n

Using good strategies and behaviours when problem-solving is key, and debugging is no exception. The techniques we use to debug our programs can make the difference between fixing an error and getting stuck, or enjoying programming and feeling frustrated. The more we understand students\u2019 approaches to debugging, the more insight we have into the struggles they might have in the classroom, and the more targeted teaching approaches for debugging can be.<\/p>\n\n\n\n

Currently, there are very few studies into school students\u2019 debugging behaviour in text-based programming languages, even though students around the world are learning to program in these languages. So, back in 2023, I decided to investigate this in the first study of my PhD.<\/p>\n\n\n\n

What we did<\/h3>\n\n\n\n

We gave several classes of 12-14-year-old students five Python programs, each of which contained some errors that beginners typically make (e.g., incorrect indentation and mixing up logical operators). Students then had to try to get these programs working by themselves in one of their computing lessons, using the Ada computer science code editor<\/a>. Here\u2019s one of the exercises below – see if you can debug it (or scroll to the end of the blog if you want to know the errors). We\u2019ll be using this as an example later on.<\/p>\n\n\n\n


\n\n\n\n

This program checks if someone should apply to be a computing teacher using the steps below:<\/em><\/p>\n\n\n\n

    \n
  • Input the user\u2019s age.<\/em><\/li>\n\n\n\n
  • Input the user\u2019s response to the question “Do you have a passion for teaching computing? Enter \u2019yes\u2019 or \u2019no\u2019:”<\/em><\/li>\n\n\n\n
  • If the user is 21 or over and does have a passion for teaching computing, the check should be a success. Otherwise, the check should be unsuccessful.<\/em><\/li>\n\n\n\n
  • Print the result of the check.<\/em><\/li>\n<\/ul>\n\n\n\n

    This program has 4 errors – have a go at fixing them all.<\/em><\/p>\n\n\n\n