Learning Portal

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

Marty Image
Back to all lessons

4.01: Starting with Python

Get Started with Python

45 MinutesPython
  • Scratch commands, for comparison with Python
  • Laptop or PC with WiFi internet access
  • -

Lesson Overview

Students will begin interacting with the Python shell so that they can play around with running different commands to control Marty before creating code using a game-based activity for creating code in Python.

In this lesson, we will be focusing on using the IDLE program to access the Python shell before creating some small scripts. This needs to be installed in each device.

Learning Objectives

  • I can describe the purpose and function of text commands.
  • I can use different interfaces to produce programs
  • I can compare different ways to write commands to complete the same goal

Key Vocabulary

  • IDLE
  • shell
  • Internet protocol address

Resources & Equipment

  • Marty the Robot
  • Marty Workbook
  • Laptop or PC with Python and MartyPy installed
  • Access to IDLE editor on programming device
  • Marty movement dice
  • Printed, cut-out Python commands

Additional Reading

-

Learning Plan & Activities

Warm-up

Have a goal for Marty to accomplish and a sample program written in pseudocode, that is supposed to achieve the goal, for the learners to discuss. Have learners work as a team to create an efficient version of the program in scratch. Perhaps learners could include a loop, change a variable, add a conditional, etc.

get learning

Share with learners Python statements that could be used to achieve the goal of the pseudocode, without defining any of the statements. Have teams talk with other teams to share and compare: did different teams use the exact same code in exactly the same order? If it isn't exactly the same: does it still accomplish the goal; is one more efficient than another; is one easier to modify if the goal of the program changes?

After learners have decided that their code is good, have learners click the windows button or open their Mac terminal. In both instances, they should type 'idle'. Then, instruct them to code along as you type the command to connect Marty and model how to enter text into IDLE and run it.

Explain that IDLE has a 'shell' which is a window allowing a programmer to enter commands that are run in Python. When the window is closed, and you don't first save, all the work is lost: saving is crucial!

Have learners enter separate Python commands into IDLE and observe the results through Marty's actions.

Demonstrate or code along creating an IDLE script and running the file.

Have learners combine Python commands, in a file, and run the file. Challenge learners to try creating either similar code in different ways or more efficient code than what was created earlier.

Create the paper dice for the game-based way of practising the code on each of the faces. Have learners show you each time they pass a challenge.

wrap-up

Ask if there are any groups wanting to display anything that they think is interesting. Ask learners for the challenges they faced with Python. Ask them if the same challenges were faced with Scratch. Ask if they can think of any other reasons a person might use Python over Scratch, for work, a hobby, research, study, etc.

Extensions & Challenges

support

Encourage learners to run small Scratch commands to remind them of the result, alternatively, have video clips of Marty carrying out Scratch commands. Have step-by-step instructions printed out for starting and using the IDLE interface.

Extend

Challenge groups to combine their work or find a way to write code that seems as if their Marty's interact with each other. Challenge learners to create pseudocode to represent possible Python code to explore in future lessons.

1

Teacher Guide - Starting with Python

PYTHON COMMANDS

Before we start programming in Python, we’re going to do a quick recap using the Python commands that have been printed out for the previous lesson, comparing them to blocks you should recognise from Scratch. Then we will use something called pseudocode to describe the flow of a program and help us to plan it. You can start to make things slightly more challenging by putting together a sequence of blocks together and asking students how they would recreate those moves.

The pseudocode example could be what is on the ppt or it could be something else, like:

Get Marty to turn 90 degrees to the right

Have Marty take 5 steps forward

Have Marty do a wiggle at the hips, after the 5 steps

USING THE PYTHON SHELL

You can read our getting started guide that has been included in this lesson pack for instructions on installing and setting up everything you need to program Marty in Python with IDLE. Once you have everything installed and ready to go, the first window that pops up when you start the application will be the Python shell. This is the window that students should start typing in their individual commands into. Firstly, starting off with importing the MartyPy library and connecting to their Marty using an IP address (this information is covered in our guide). Get students to experiment with typing in the commands that we have printed out and see them happen in real life.

MOVEMENT DIcE GAME

Once students are comfortable with using some of the Python commands for Marty, it’s time to create short scripts and run them. There are instructions in our guide for creating and running Python scripts with IDLE. Ensure that students save each of the challenges that they attempt when playing the movement dice game with other groups so that, at the end, they can easily run all of them again!

  • Curriculum for Excellence - Technologies Benchmark Guide: Computing Science
  • CSTA Education Standards
  • Curriculum for Excellence - Literacy Benchmark Guide: Listening and Talking
  • Curriculum for Excellence - Health and Wellbeing across Learning Guide: Mental, Emotional, Social and Physical Wellbeing
  • Australian f-10 Curriculum – Digital Technologies, Design & technologies: Digital Technologies
  • National Curriculum - Computing, Design and Technology: Computing
  • Curriculum for Excellence - Literacy Benchmark Guide: Reading
  • Curriculum for Excellence - Literacy Benchmark Guide: Writing
  • International Society for Technology in Education (ISTE)
Curriculum OrganiserExperiences and Outcomes Covered
Understanding the world through computational thinking
TCH 4-13b
Understanding and analysing computing technology
TCH 4-14a
TCH 4-14b