Fixing the Hands-Up Problem: 7 Python Debugging Routines
Research-backed fixes for the hands-up problem in Python lessons: seven debugging routines, with common error examples, to get students unstuck faster.
By Yuness, qualified Computer Science teacher and former Head of KS5 Computer Science · Last reviewed 21 November 2026
The "hands-up problem" is the name researchers at the Raspberry Pi Computing Education Research Centre (University of Cambridge) gave to a familiar scene: many students in a programming lesson put their hands up for debugging help at once, and one teacher cannot reach them all. The fix is not to work faster but to teach debugging as a routine: give students a set order of things to try before they ask, make reading error messages a habit, and model your own debugging out loud. Below are seven routines you can run in Python lessons from next week, each linked to the research behind it and to a common beginner error.
The seven routines at a glance
| Routine | What students do | Example error | Main research link |
|---|---|---|---|
| 1. Read the error message | Find the line number, error type and message before touching the code | NameError | Gale and Sentance; Becker et al. |
| 2. Three before me | Try themselves, their notes and a partner before the teacher | SyntaxError (missing colon) | Gale and Sentance |
| 3. Explain it to a partner | Talk through what each line should do, out loud | TypeError (str + int) | Gale and Sentance; NCCE pair programming |
| 4. Predict, then run | Write down the expected output before pressing run | Off-by-one in range | PRIMM; Gale's seminar findings |
| 5. Live-code a bug fix | Watch the teacher hit and fix a planned bug, thinking aloud | IndentationError | NCCE live coding Quick Read |
| 6. Debugging cards | Match the error to a card that says what to check first | All five | Gale and Sentance |
| 7. Help queue with traffic lights | Signal status and join a queue with a short help ticket | SyntaxError (unclosed string) | Gale and Sentance; Hennessy Elliott et al. |
What the research on the hands-up problem actually found
The study is "The Hands-Up Problem and How to Deal With It" by Laurie Gale and Sue Sentance, published in Informatics in Education (volume 25, issue 1, online 15 March 2026). A preprint is free on arXiv.
What they did
- Who: nine teachers who taught a text-based language (all taught Python) at key stage 3, ages 11 to 14. Seven were in England and two in other countries; most worked in state-funded schools.
- How: semi-structured online interviews of 35 to 65 minutes, held between October and December 2023, analysed using codebook thematic analysis. Students were not interviewed and lessons were not observed.
- Result: six themes, including students' reliance on the teacher for debugging help, which the authors conceptualised as the hands-up problem.
What drives it and what it costs
The paper splits the drivers into two kinds. General ones are about feelings and habits: low resilience, low self-efficacy and little motivation to solve problems independently. Programming-specific ones include difficult syntax, hard-to-interpret error messages and misconceptions. The consequences fall on both sides: students stay stuck, get frustrated and disengage, while teachers describe busy or chaotic lessons, pressure to help everyone, feelings of inadequacy and a temptation to over-scaffold.
The strategies teachers reported
The teachers who described ways of countering the problem tended to be the more confident ones, often with decades of experience. The strategies they described (the paper calls many of them "counters") included:
- refusing to help until a student has shown they have tried to debug;
- encouraging peers to help each other before asking the teacher;
- rewarding effort, not only working programs;
- building a positive error culture, for example "sabotage" activities where students add bugs to each other's code;
- modelling debugging, often by live coding;
- teaching students to "decode" error messages and pre-cueing them to look for common errors;
- teaching the habit of small changes and frequent testing; one teacher put it as "make one change, test it, make another change, test that";
- asking generic questions, such as what the student has already tried, and encouraging students to explain their thinking (rubber ducking).
Limitations worth knowing
The authors are open about the limits. Nine self-selecting teachers is a small sample, and they were probably more engaged with research than most. Everything comes from interviews, so these are teachers' accounts of what they do, not observed or measured effects. The paper tells you what experienced teachers find workable; it does not prove that any single strategy reduces raised hands. That is how the routines below should be read: grounded in research and practice, but not tested as a package.
Routine 1: Read the error message, out loud, before anything else
How to run it
Teach a three-question protocol and display it: Which line? What type of error? What is the message telling me? When a student's hand goes up, your first response is "read me your error".
Example: NameError
| Line | Code |
|---|---|
| 1 | score = 10 |
| 2 | print(Score) |
Python 3.13 reports: NameError: name 'Score' is not defined. Did you mean: 'score'? The answer is in the message itself; Python is case-sensitive, so Score and score are different names.
Why it works
Hard-to-interpret error messages were one of the drivers teachers identified, and some teachers taught students to decode them. A large literature review by an international working group led by Brett Becker, "Compiler Error Messages Considered Unhelpful" (ITiCSE working group, 2019), concluded that error messages cause substantial difficulty, particularly for novices. A later Dagstuhl seminar report on error messages (2022) noted that experts treat a message as a debugging tool, while novices often see the message itself as the problem. The protocol is about turning the message into a tool. Python has also helped: since Python 3.10 (October 2021), messages such as expected ':' and "Did you mean" suggestions are more specific. Older versions, and some browser-based tools, word messages differently, so check what your students actually see.
Routine 2: Three before me
How to run it
Before asking you, a student must try three things: (1) read the error and have a go themselves, (2) check their notes, the example code or a debugging card, and (3) ask a neighbour. When they do ask you, they tell you what they tried. Be consistent, or the routine will not stick.
Example: SyntaxError (missing colon)
| Line | Code |
|---|---|
| 1 | name = input("What is your name? ") |
| 2 | if name == "Sam" |
| 3 | print("Hello Sam") |
Python reports SyntaxError: expected ':' on line 2. This is exactly the kind of error a partner can spot in seconds.
Why it works
Two of the counters in Gale and Sentance's study were refusing help until a student has tried, and directing students to peers and other sources first. "Three before me" is a common name for that combination; the paper itself does not use the phrase. The NCCE's Quick Read on pair programming also notes that partners help each other debug and catch syntax errors as they arise.
Routine 3: Explain it to a partner (rubber duck debugging)
How to run it
The stuck student explains, line by line, what each line is supposed to do. The listener only asks questions: "What is stored in that variable?", "What type is it?", "What have you tried already?" The listener must not touch the keyboard. With no partner free, a rubber duck or toy will do.
Example: TypeError when joining a string and a number
| Line | Code |
|---|---|
| 1 | age = 14 |
| 2 | print("You are " + age + " years old") |
Python reports TypeError: can only concatenate str (not "int") to str. Saying "age holds the number 14" out loud is often enough for the student to see the problem. Fixes include str(age) or print("You are", age, "years old"). The same message appears when a student does input() and then adds 1 to the result, because input() always returns a string.
Why it works
Gale and Sentance report teachers encouraging students to externalise their thinking, with one describing it as rubber ducking, and asking generic questions about what the student has already tried, which need no expert knowledge. A classmate can ask them as well as you can.
Routine 4: Predict, then run
How to run it
Before pressing run, students write down what they expect the program to output. If the real output differs, the gap is the bug. Make one rule explicit: you may not run the program again until you have changed something on purpose and can say why.
Example: off-by-one in range
| Line | Code |
|---|---|
| 1 | for i in range(1, 10): |
| 2 | print(i) |
The task was to print 1 to 10, but this prints 1 to 9, because the stop value in range is excluded. There is no error message at all, which is why prediction is the only way to catch it. The fix is range(1, 11).
Why it works
Prediction is the first stage of PRIMM (Predict, Run, Investigate, Modify, Make). The NCCE's PRIMM Quick Read cites a 2018 study of 500 learners aged 11 to 14 whose outcomes improved after 8 to 12 weeks of PRIMM-based lessons. In a Raspberry Pi Foundation seminar write-up (October 2024), Laurie Gale reported, from his analysis of how 12 to 14-year-olds debugged, that 74% of the students at some point pressed run again and again without changing anything (the write-up does not give the sample size), and that less successful students tinkered with frequent one- or two-character edits, often running the program before reading the code closely. Predict-then-run targets both habits. Gale and Sentance's PRIMMDebug (described in a preprint) adds a structured debugging process (predict, run, spot the defect, inspect, find, fix, test) to an online tool. In its small classroom trial (log data from 69 students aged 11 to 16, 46 survey responses, a convenience sample), students were evenly split on the process and most disliked being blocked from running or editing code. The one restriction most students found helpful (73%) was having to identify the faulty line before fixing it, which is easy to copy: "tell me the line number first".
Routine 5: Live-code a bug fix
How to run it
Once or twice a week, write code in front of the class and plan in a mistake that matches an error they keep making. When it fails, stay calm, read the error aloud using the Routine 1 questions, ask the class to predict where the problem is, then fix and re-run. Narrate everything, including your wrong guesses.
Example: IndentationError
| Line | Code |
|---|---|
| 1 | score = 10 |
| 2 | if score > 5: |
| 3 | print("Well done") |
Python reports IndentationError: expected an indented block after 'if' statement on line 2. Point out that Python flags line 3, and the message refers back to the if statement on line 2 that needs an indented block after it.
Why it works
The NCCE's Quick Read on live coding recommends planning intentional mistakes that match common errors, thinking aloud, going slowly, testing often and asking learners to predict before running; it describes making mistakes as "a common (if not crucial) part of programming". Live coding was also a popular way for the teachers in Gale and Sentance's study to model debugging, sometimes with just the small group of students who shared the same error. The Raspberry Pi Foundation's review of programming pedagogy (2021) also suggests asking pupils to spot mistakes during a demonstration.
Routine 6: Debugging cards for common Python errors
How to run it
Make one card per error you see most often: the error name, a tiny example, what it usually means and the first thing to check. Keep them on desks or on a wall. Add a card whenever a new error starts filling your queue. For a positive twist, run a "sabotage" round where pairs add one bug from the cards to a partner's working program, and the partner has to find it.
Example card set
| Error | Usually means | Check first |
|---|---|---|
SyntaxError: expected ':' | Missing colon after if, for, while, def or else | The end of the line Python points to |
IndentationError: expected an indented block | The line after a colon is not indented | The line just after the statement named in the message |
NameError: name '...' is not defined | A typo, wrong capital letter, missing quotes, or a variable used before it is created | Spelling and capitals against where the variable was first set |
TypeError: can only concatenate str (not "int") to str | Joining text and a number with + | Use str(), commas in print, or int(input()) |
| No error, but output is one short | Off-by-one: the stop value in range is excluded | Predict the first and last values, then compare |
The error messages above are copied from Python 3.13; Python 3.11 and 3.12 give the same wording.
Why it works
Signposting curated resources, pre-cueing students to look for common errors and sabotage activities were all counters described by teachers in Gale and Sentance's study; sabotage helps because the bug belongs to someone else, which takes the sting out of finding it. Becker and colleagues' review also gathers guidelines for better error messages, which, according to a published summary, include showing examples of similar errors and offering hints; a card does something similar on paper.
Routine 7: A help queue with traffic lights
How to run it
Replace raised hands with a visible signal: green (working), amber (stuck but trying the routines) and red (tried everything, need the teacher). Red means a name goes on the board in order, with a short help ticket: line number, error type and what has been tried. While waiting, the student moves on to the next task or helps an amber neighbour. When you arrive, the student keeps the keyboard.
Example help ticket: SyntaxError (unclosed string)
| Line | Code |
|---|---|
| 1 | print("Hello) |
Ticket: "Line 1. SyntaxError: unterminated string literal (detected at line 1). Tried: checked brackets, asked Sam." Often, writing the ticket is enough for the student to spot the missing closing quote.
Why it works
The teacher-side costs in Gale and Sentance's study (chaos, pressure to help everyone, over-scaffolding) come from unmanaged demand, and a queue makes that demand visible and orderly. An observational study of five US teachers (grades 6 to 9) supporting debugging (ACM Transactions on Computing Education, 2024) described a teacher whose 25 students were constantly looking for his support; none of his observed debugging moments lasted more than 130 seconds without being interrupted. It also described a teacher taking over the trackpad to fix a problem while the student only watched, with the cause never discussed, so he was left with only what he had seen. It is a small study in a physical computing context, but it supports the keyboard rule. The traffic-light system itself is a widely used classroom technique rather than something these studies tested.
Underneath all seven: a positive error culture
The emotional side came through strongly in Gale and Sentance's interviews, and promoting a positive error culture was one of their six themes. In practice that means normalising and even celebrating errors, praising persistence rather than only working code, and giving students erroneous code to fix so mistakes feel depersonalised. A teacher quoted in the Raspberry Pi Foundation seminar write-up summed up the aim as "Take the fear out of it."
Can instant feedback tools reduce the waiting?
Gale and Sentance suggest, as a direction rather than a tested finding, that more informative error messages and debugging tools could reduce students' dependency on the teacher for feedback. That is the gap automatic feedback tools aim to fill: if a student finds out straight away what is wrong and what to try next, fewer questions reach the queue.
Shuttle's free Python platform for schools, which I built first for my own students, works this way. Students write real Python in the browser with nothing to install, and every answer is marked the moment it is submitted, with feedback pointing to the exact mistake and a next step. A "Summarise" button shows you the most common mistakes and where each student got stuck, which you can use to decide what to live-code next lesson. It covers GCSE, A Level and IB, and it is free for schools. If you are comparing options, see our guide to free Python platforms for schools, and for planning a whole unit see how to teach Python to Year 9 without marking 30 scripts.
Tools work best alongside the routines, not instead of them.
FAQ
What is the hands-up problem in programming lessons?
It is the term Gale and Sentance (Raspberry Pi Computing Education Research Centre, University of Cambridge) use for students' common reliance on the teacher for debugging help, shown by many raised hands at once. It comes from interviews with nine secondary teachers, published in Informatics in Education in 2026.
Should I teach debugging explicitly or let students work it out?
Teach it explicitly. The more confident, experienced teachers in Gale and Sentance's study described modelling debugging, teaching students to decode error messages and teaching habits like small changes with frequent testing. The authors recommend more debugging-specific professional development to help less confident teachers develop these approaches.
Which Python errors should I teach first?
Start with the ones beginners meet in their first few lessons: SyntaxError (such as a missing colon or quote), IndentationError, NameError, the TypeError from joining text and numbers, and logic errors such as off-by-one in range. For GCSE students, our guide to producing robust programs covers testing and error types, and languages and IDEs covers the tools that help.
Can AI explain error messages to students instead of me?
Possibly, with care. In a Raspberry Pi Foundation pilot (September 2024), eight expert teachers found most AI-generated explanations sensible, but every one of them met at least one invalid explanation, and they preferred explanations that guide students rather than hand over the fix.
Is "three before me" backed by research?
Not under that name. The underlying moves, making students try first and directing them to peers and resources before the teacher, are among the strategies reported in Gale and Sentance's study, but nobody has tested "three before me" as a named routine in programming lessons.
If you would like your students to get instant, specific feedback while you work the queue, you can request access to the free platform at shuttlelearning.com/schools. Schools are onboarded one at a time via the form on that page.