5_resized-554x368.png

Python 101 - Lesson 5

11-13 yrs old

14-18 yrs old

Computer Science

Technology

A HELPER FOR THE HOME Agent

0
avatar Submitted By: Minecraft Education

September 8, 2020

Skills

  • Creativity
  • Critical Thinking

Learning Objectives

  • Develop programs with sequences and simple loops, to express ideas or address a problem. 1A-AP-10
  • Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process. 1B-AP-11
  • Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intende. 1B-AP-15

Guiding Ideas

In this lesson the students will learn:

- the concept of loops.

- to use the for loop.

- the concept of, and how to use, nested loops.

- to use indentations.

- to code the Agent in Minecraft.

Tell the students that they need to help CodingMine with the development of their new top-secret project called the Agent. The Agent is a robot that can be controlled using code to do a wide range of actions. The Agent is a companion that can help in many different situations ranging from housework to production in factories. Tell the students that they will be coding the Agent to do different jobs around a house in this lesson. Tell the students that they will be using different commands to control the Agent. These commands are agent move, agent place, agent collect all and agent drop all.

Student Activities

Coding Concepts:

- Loops

- Nested Loops

User interface. In this lesson the students will:

- see displayed world coordinates in the top left-hand corner.

- see displayed Agent world coordinates in the top left-hand corner.

Syntax/Operators: colon, indentation

Coding activities: (30 min)

1. Activity 1: Too heavy.

Explain to the students that the developer needs their help to code the Agent to make it lift heavy objects around the house. This function of the Agent is going to greatly help people who cannot move such objects without injuring themselves. Tell the students that they will do this Activity in two   parts. Firstly, the students need to code the Agent to move one heavy box. Then they need to code the Agent, using a loop, to move multiple heavy boxes.

2. Activity 2: Spin cycle

Explain to the students that the developer needs their help to code the Agent to make it do laundry. They will have to code the Agent to pick up dirty laundry, put it in the washing machine and then get the Agent to spin around to wash the clothes using a loop. The Agent should then place the clean clothes in a pile. The students will carry out this Activity in two parts, the second being coding the Agent to do multiple loads of laundry using a second loop.

3. Cleaning up

Explain to the students that the developer needs their help to code the Agent to make it vacuum carpets. Tell them that this activity will be done in two parts. They first have to code the Agent to vacuum a small carpet and in the second part they need to code the Agent to vacuum a large carpet and throw the dirt in the trash.

Performance Expectations

Ask the students about the skills that they have learned during the lesson, to reinforce the concepts.

Q. What is a for loop?

A. A for loop is a coding command that repeats a piece of code a certain number of times.

Q. What do you use indentations with loops for?

A. To show what code needs to be looped.

Q. How do we make the Agent move in a certain direction?

A. Using the agent move command.

Q. What is a nested loop?

A. A nested loop is a loop inside another loop.

Skills

  • Creativity
  • Critical Thinking