How to use the
Learning Portal

Learning Portal

Our hands-on, comprehensive lesson plans span a range of levels. Browse our free STEM and coding learning resources.

Marty Image

4.03: Programming Marty with Python

45 Minutes

Lesson Overview

In this lesson, students get more practice with creating and running commands that will move different parts of Marty's body. Students should start to develop an understanding of the outcome of different coding commands on Marty and the environment that he is in. They should also start to gather a better understanding of the Python syntax.

Key vocabulary:
    Parameter, Syntax, Import, IDLE,

Content Sections

  • Learning Objectives
  • Warm-up
  • get learning
    • Wrap-up
    • Extensions & Challenges
    • Support
    • Extension
    • Additional Reading
    • 4.03: Programming Marty with Python

      45 Minutes

      Lesson Overview

      In this lesson, students get more practice with creating and running commands that will move different parts of Marty's body. Students should start to develop an understanding of the outcome of different coding commands on Marty and the environment that he is in. They should also start to gather a better understanding of the Python syntax.

      Key vocabulary:
        Parameter, Syntax, Import, IDLE,
      • Knowledge of basic Python programming commands
      • Python compatible, with wifi enabled
        • Marty the Robot
        • Student Workbook
        • Python editor (such as IDLE)
        • Access to computers/laptops (with Python & MartyPy installed)
        • Marty Says cards

      Learning Objectives

      • I can describe the meaning of code in a program and the purpose of parameters in a command.
      • I can write a command to efficiently carry out an action.

      Warm-up

      Remind learners that computers take instructions exactly as you write them. There is no understanding or thinking about what you mean, there is only what you write, 'literally', what you write.

      Have learners pair up and sit back to back. Have one describe a robot to the other, who will draw it. The drawer cannot ask for more information, the describer cannot turn around and have a look.

      Once a drawing is complete, have them switch roles and repeat the exercise. Open it up for a different subject to draw.

      get learning

      Have learners explore Marty fully, in terms of joints and possible movements available. Think back to the drawings the learners just completed and the need for specific instructions.

      After learners have had a chance to thoroughly explore the available movement Marty can display, share the ppt presentation, starting with the commands, and stop at slide 13; encourage learners to jot down commands that they think they might want their Marty to display. Draw attention to the parentheses that follow each of the movements Marty might be able to carry out. Sometimes the parentheses are empty and sometimes they are not, ask why this might be by comparing examples: for walk, why might values be important; for hello, why might values not be important? Have learners remember this for future coding exercises.

      Have learners click the windows button or open their Mac terminal. In both instances, they should type 'idle'. Have learners code along from slide 15: load martypy and connect their Marty with the IP address, most easily found by connecting through the app.

      Show the 4 commands and their parameters, in parentheses, from the presentation (slide 17); each time a command is written, for learners to copy, have the template up and describe what each of the parameters means. The commands are:

      • marty.eyes()
      • marty.leg lift()
      • marty.arm lift()
      • marty.lean()

      Encourage learners to take time to experiment with the values within the parentheses: have them use the same command, changing the values and have learners note the effect.

      Make the larger Marty library available to learners. Encourage group work, suggesting learners combine commands to see the result or think of how combining different commands could complete a task that one command can't. Ask for volunteers to share any interesting code or code that had been challenging, but the group figured out what it meant.

      Wrap-up

      Bring learners together to share challenges and successes. Ask if anyone grouped a set of commands to perform actions. Did they notice any other similarities to Scratch that they may have seen in prior lessons? Ask learners to think about commands that might be useful to learn for coding Marty. Ask them to think about scenarios that might be useful for a robot like Marty to be used in.

      Extensions & Support

      Support

      Have cards available for learners, with the boilerplate for the commands on them. Below the boilerplate, have basic descriptions for each of the parameters.

      All programming should be group or paired, this is the norm for programmers, remind learners that, generally speaking, programmers work in pairs to write code.

      Extension

      Challenge learners to start chaining commands to accomplish something. Have them think up tasks to complete: how could you code that? How could you code that more efficiently?

      Challenge peers to write code that would end up in the same position as a set pose.

      • Technologies: Computing Science
      • Literacy & English: Listening and Talking
      • Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
      • Literacy & English: Reading
      • Literacy & English: Writing
      • CSTA Education Standards
      • Digital Technologies, Design & technologies: Digital Technologies
      • Computing, Design and Technology: Computing
      • International Society for Technology in Education (ISTE)