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.01: Starting with Python

45 Minutes

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.

Key vocabulary:
    IDLE, shell, Internet protocol address,

Content Sections

  • Learning Objectives
  • Warm-up
  • get learning
  • wrap-up
  • Extensions & Challenges
  • support
  • Extend
  • Additional Reading
  • 4.01: Starting with Python

    45 Minutes

    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.

    Key vocabulary:
      IDLE, shell, Internet protocol address,
    • Scratch commands, for comparison with Python
    • Laptop or PC with WiFi internet access
    • -
      • 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

    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

    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 & Support

    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.

    Additional Reading


    • 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)