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

3.12 Guess the number continued

45 Minutes

Lesson Overview

Continuing from Lesson 1.11, students will finish coding their number guessing game where they will need to use both while and for loops. For students who finish this activity quickly, there are a number of challenges for them to extend their programs with.

Key vocabulary:
    For Loop, While Loop, Number, Condition, Control, User Input,

Content Sections

  • Learning Objectives
  • Extensions & Challenges
    • Additional Reading
    • 3.12 Guess the number continued

      45 Minutes

      Lesson Overview

      Continuing from Lesson 1.11, students will finish coding their number guessing game where they will need to use both while and for loops. For students who finish this activity quickly, there are a number of challenges for them to extend their programs with.

      Key vocabulary:
        For Loop, While Loop, Number, Condition, Control, User Input,
      • 3.1, 3.2, 3.5, 3.6, 3.9-3.11
      • Laptop or PC
      • Technologies/Literacy/Numeracy
        • Marty the Robot
        • Student workbooks (Lesson 4)
        • Devices with a Python editor and martypy installed

      Learning Objectives

      • Describe examples of when a for loop is needed
      • Describe examples of when a while loop is needed
      • Design and build a program that uses both a for and while loop
      • Draw a flowchart for a program with nested loops
      • Differentiate between a for and while loop

      1. Discuss with students how they got on with coding their number guessing game in the previous lesson

      a. What stage is everyone at?

      b. How easy is this task? What has been difficult so far?

      2. Students to continue working in their groups to finish coding the guess the number game with Marty and once finished, should work through the challenges below

      Extensions & Support

      • What should happen if the player enters in a string (text), how should Marty respond? (Technologies/Literacy/ Numeracy)
      • Extend your program so that the player has a limited number of chances to guess correctly, you can decide how many chances the player should get (Technologies/Numeracy)
      • How could you make your game more difficult? Would changing the range the numbers could be picked from make it more difficult? (Technologies/Numeracy/Literacy)
      • Add a hint for the player like a fact about the number that has been selected such as if it is an odd or even number (Technologies/Numeracy)

      Additional Reading

      • Marty the Robot Educator Guide
      • Educator FAQ
      • Getting Started with Python
      • MartyPy Documentation