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.8 Processing complex user input

45 Minutes

Lesson Overview

So far, students have created a chatbot for Marty that is responsive and validates user input. When asking the user to suggest values for Marty movements, it would be nice if they could give all the values needed for one move in one go. To do this we will need string manipulation to pull out the required information.

Key vocabulary:
    Chatbot, Decision Making, Control, User Input, String Manipulation, Variable,

Content Sections

  • Learning Objectives
  • Extensions & Challenges
    • Additional Reading
    • 3.8 Processing complex user input

      45 Minutes

      Lesson Overview

      So far, students have created a chatbot for Marty that is responsive and validates user input. When asking the user to suggest values for Marty movements, it would be nice if they could give all the values needed for one move in one go. To do this we will need string manipulation to pull out the required information.

      Key vocabulary:
        Chatbot, Decision Making, Control, User Input, String Manipulation, Variable,
      • 3.1-3.7
      • Laptop or PC
      • Technologies/Literacy/Numeracy
        • Marty the Robot
        • Student workbooks (Lesson 4)
        • Devices with a Python editor and martypy installed

      Learning Objectives

      • Describe when you might need to use string manipulation whilst coding
      • Use string manipulation of user input to breakdown the text to be used as parameters for Marty movements
      • Explore values needed for different Marty moves

      1. Discuss with students what different values/parameters are needed for Marty movements (examples in workbooks)

      a. Reflect on individual chatbots and whether this movement is used

      b. Do students ask the user to customise the values for this movement through user input

      c. Ask students how they would ask users for values to create the movement

      2. Demonstrate that we can ask users for all values in one go that we can then split up into individual values

      3. Class to work together to complete the example given in the ppt

      4. Continue to work on the chatbot to include this approach and ask users to customise the values for walking

      Extensions & Support

      • Students should rotate around the different group chatbots and leave feedback for that chatbot including things that they liked and ways they think it could be improved (Technologies/Literacy)
      • Write a how-to guide for creating a chatbot in Python that other students could follow (Technologies/Literacy)

      Additional Reading

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