Skip to content
Learning Site
Home

About

  • About Robotical
  • Case Studies
  • Meet the Team
  • Blog
  • Contact Us

Our Products

  • Marty the Robot
  • Axiom
  • Cog

Teach

  • Lessons & Resources
  • Marty for Educators
  • Funding & Grants
  • Professional Development
  • Why Teach STEM?
  • Coding Environments
  • Student Led Learning

Let's Code

  • Marty the Robot
  • Code Online
  • Marty Apple App
  • Marty Android App
  • Update your Marty
  • Cog
  • Code Online
  • Cog iOS App
  • Cog Android App
  • Axiom
  • Axiom Science

Support

  • Marty Get Started
  • Cog Quick Start Guide
  • Axiom Science Quick Start Guide
  • Support & FAQs
  • Marty V2 User Guides
  • Marty V1 Resources
  • Request Support
  • Request Top-Up Training

Shop

  • Marty the Robot and Physical Computing
  • Class Packs
  • Add Ons & Extras
  • Account
  • Shipping, Returns & Cancellations
  • Distributors
HomeLessonsUnits of workCurriculum standardsTutorials

Information

  • Lessons & Resources
  • Knowledge Base & User Guides
  • About Us
  • Shipping, Returns & Cancellation
  • Privacy Policy
  • Learning site privacy
  • Terms of Service
  • Partner Hub

Support & Help

  • Support & Help Center
  • Getting Started with Marty V2
  • Getting Started with Marty V1

Learning, Resources & Guides

  • Marty V2 Lessons Site
  • Marty V1 Lessons Site

Contact Us in the UK

Stanhope House,12 Stanhope Place,Edinburgh,United Kingdom,EH12 5HH
(+44) 0131 564 0922
hello@robotical.io
Contact Us

Contact Us in the US

2810N Church St, PMB 61694,Wilmington,Delaware,USA19802-4447
(+1) 833 886 1661
hello@robotical.io
Contact Us

Why not join our mailing list?

For News, New Products and Special Offers

Join mailing list

Copyright 2016-2026 © Robotical Ltd

All lessons
Marty app
CurrentPrevious

4.02: Debugging in Python

Begin to debug, with Python.

4.02: Debugging in Python
Estimated time
45 minutes
Difficulty
Intermediate
Products
Marty V2

On this page

  1. Lesson overview
  2. Objectives & resources
  3. Key vocabulary
  4. Lesson plan
  5. Extensions and challenges
  6. Additional reading
  7. Curriculum standards

Extensions and challenges

Support

Share a list of common bugs, with Python code examples for learners to use as a reference.

This lesson needs to be group-based: everytime a bug is discovered, the person discovering it must clearly describe why they think this by sharing with the rest of the group.

The group must not move on to the next script until everyone is able to describe why the bug prevents the script from running properly.

extend

Have learners create buggy code for their peers or for the teacher. Encourage creativity in what they write. Share with learners that some bugs are intentional - they might lower security of an app or website. How might a flaw be exploited by people who want to harm others? Encourage learners to research this, either during or after the lesson.

Additional reading

Getting Started with MartyPy

Curriculum standards

19
Choose your curriculum to see the relevant standards.

19 of 19 linked standards shown.

Australian CurriculumAustralia2
Curriculum areaLinked standards
Digital Technologies, Design & technologies: Digital Technologies

Select a code to read the full standard.

Digital Technologies, Design & technologies: Digital Technologies

  • ACTDIP040Design algorithms represented diagrammatically and in structured English and validate algorithms and programs through tracing and test cases
  • ACTDIP041Implement modular programs, applying selected algorithms and data structures including using an object-oriented programming language
CSTA Education StandardsUSA2
Curriculum areaLinked standards
General standards

Select a code to read the full standard.

  • 3A-CS-03Develop guidelines that convey systematic troubleshooting strategies that others can use to identify and fix errors.
  • 3A-AP-17Decompose problems into smaller components through systematic analysis, using constructs such as procedures, modules, and/or objects.
Curriculum for ExcellenceScotland12
Curriculum areaLinked standards
Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
Literacy & English: Listening and Talking
Literacy & English: Reading
Literacy & English: Writing
Technologies: Computing Science

Select a code to read the full standard.

Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing

  • HWB 0-11a / HWB 1-11a / HWB 2-11a / HWB 3-11a / HWB 4-11Social wellbeing
  • HWB 0-14a / HWB 1-14a / HWB 2-14a / HWB 3-14a / HWB 4-14aSocial wellbeing

Literacy & English: Listening and Talking

  • LIT 3-05a / LIT 4-05aFinding and using information
  • LIT 4-07aUnderstanding, analysing and evaluating
  • LIT 4-09aCreating texts

Literacy & English: Reading

  • LIT 3-15a / LIT 4-15aFinding and using information
  • LIT 4-16aUnderstanding, analysing and evaluation

Literacy & English: Writing

  • LIT 3-20a / LIT 4-20aEnjoyment and choice
  • LIT 3-22a / LIT 4-22aTools for writing
  • LIT 4-23aTools for writing

Technologies: Computing Science

  • TCH 4-13bUnderstanding the world through computational thinking
  • TCH 4-14bUnderstanding and analysing computing technology
England's National CurriculumEngland1
Curriculum areaLinked standards
Computing, Design and Technology: Computing

Select a code to read the full standard.

Computing, Design and Technology: Computing

  • ✔️Understand what algorithms are; how they are implemented as programs on digital devices; and that programs execute by following precise and unambiguous instructions
ISTEUSA2
Curriculum areaLinked standards
International Society for Technology in Education (ISTE)

Select a code to read the full standard.

International Society for Technology in Education (ISTE)

  • 5cStudents break problems into component parts, extract key information, and develop descriptive models to understand complex systems or facilitate problem-solving.
  • 6cStudents communicate complex ideas clearly and effectively by creating or using a variety of digital objects such as visualizations, models or simulations.

Resources

Learner resources

  • Treasure Hunt filesFile links loading
  • Python Student Workbook - Debugging in PythonFile links loading

Educator resources

  • Marty Teacher Guide – Debugging in PythonFile links loading
  • Presentation for Debugging with PythonFile links loading

Solution resources

  • Debugging in Python SolutionsFile links loading

Lesson overview

Finding problems and errors in Python looks different when compared to Scratch, but the end goal is the same: working code. In this lesson, we cover some easy ways to find the problem with our programs and put them to the test briefly. Students will be using the IDLE editor in this lesson to create and modify Python programs.

Prerequisite knowledge

Debugging in Scratch, emerging knowledge of Python commands

Cross-curricular links

Literacy - proofing, Maths - sequencing

Learning objectives

  • I can identify where the written code and the intention for the code is different and fix the discrepancies.
  • I can describe some historical figures who have had an impact on the world of computing science.

Resources and equipment

  • Marty the Robot
  • Marty Workbooks
  • Python treasure hunt scripts and instructions
  • Laptop or PC with Python, MartyPy and IDLE installed

Key vocabulary

  • bug
  • error
  • debugging
  • syntax

Lesson plan

warm-up

Show a short video about the first example of debugging, in computing.

Warm up activity, go through two or three short scripts from the ppt, with learners offering suggestions what each of the statements do. Each short script will have an error that could easily be missed. Run the scripts on the teacher machine and display the result - perhaps Marty will move, perhaps not. The buggy text should include missing quotations, lower/upper case mistakes, spelling mistakes, conditions that will always be true/false, code in the wrong order,

Have learners look more critically at the scripts to find if they can spot an error / a bug. Have them suggest fixes for the problem. End on a more complex example, providing the equivalent Scratch block. Make sure to try running the code again after discussion / debugging.

get learning

Discussion with students around why they think we need debugging and why things don’t always work like we expect when programming. What if programmers didn't take the time to debug? What might happen for a user, like us, when we: go to a website; use a device; play on an app; interact with a calculator; plan a journey, when the program that is necessary, for whatever we use, has a bug? What kinds of problems are possible?

List ideas on the board or have learners record them somewhere. Look back to the code samples from the warm up, try to identify why they might be bugs: why would they stop a program from running, properly?

Students should go into small groups of around 2-3, where each group has access to a Marty .

Students in the group should work together to work their way through the Python treasure hunt where they will have to debug some short scripts to get enough clues to work out a fact about Marty. Each of the first four scripts will have one or more of the bugs already seen in the lesson. As the clues progress, the number of bugs, and complexity of the bugs, should increase. The last script is almost blank; learners need to use commands, from the documentation, that they have not yet written.

wrap-up

Have learners compare written English to written code. Have them think how the two are different: consider dialect, accent, syntax or a person's ability to comprehend what the writer means. How is a computer different, why must we treat the computer differently when writing code?

Imagine what might happen if a computer or program was able to think about what the programmer was meaning when it encounters a bug: might it make things better; might it make things worse? Have learners share suggestions.