Lesson plan

Python 101 with MakeCode - Lesson 5

Program the Minecraft Agent using Python loops and movement commands to automate household chores like moving boxes, washing laundry, and vacuuming.

Python 101 with MakeCode - Lesson 5
Ages
Ages 11+
Duration
1 hour
Essential question

How can loops and robotic commands automate repetitive tasks in our living environments?

Overview

In this lesson, students assist the fictional company CodingMine to program their automated assistant, the Agent. Learners explore how robotic automation can handle domestic chores, developing a problem-solving mindset as they write code to manage repetitive physical tasks.

Using MakeCode Python within Minecraft, students practice core computer science concepts including for loops, code indentation, and nested loops. By applying commands such as agent move, place, collect all, and drop all, students direct the Agent to transport heavy boxes, cycle laundry, and vacuum carpets.

Learning objectives

By the end of this lesson students will be able to:

  • Apply for loops to repeat Agent actions a set number of times.
  • Use proper indentation to define the code block controlled by a loop.
  • Construct a nested loop to repeat a multi-step sequence.
  • Control the Agent using movement, placement, and item collection commands.

Blocks and items used in this lesson

Key vocabulary

Agent
A programmable in-game robotic helper that can be directed through code to perform tasks.
for loop
A command structure that executes a block of code a specified number of times.
Indentation
The spacing at the beginning of a line of code that shows which commands belong inside a loop.
Nested loop
A loop situated entirely inside the body of another loop.

Before class

Lesson sequence

Suggested timing: about 60 minutes in total.

  1. Introduction to the Agent10 min

    Introduce CodingMine's project and explain that the Agent is designed to assist with tasks from domestic housework to factory work. Review the basic commands: agent move, agent place, agent collect all, and agent drop all.

  2. Activity 1: Too Heavy15 min

    Guide students to code the Agent to lift heavy objects to prevent injury. In Part 1, students write code to move a single heavy box. In Part 2, students use a for loop to direct the Agent to move multiple boxes.

  3. Activity 2: Spin Cycle20 min

    Direct students to automate the laundry process. Students code the Agent to pick up dirty clothes, put them into the washing machine, spin in a loop to wash them, and stack the clean clothes. In Part 2, students implement a second loop to run multiple loads.

  4. Activity 3: Cleaning Up10 min

    Challenge students to program carpet cleaning routines. In Part 1, learners code the Agent to vacuum a small carpet. In Part 2, they program the Agent to vacuum a larger area and dispose of the collected dirt in the trash.

  5. Review and Formative Assessment5 min

    Convene as a class to review the key coding principles learned during the tasks, focusing on how loops streamline repetitive tasks and why correct indentation is necessary in Python.

Assessment: success criteria

  • Student successfully uses a for loop to automate moving multiple boxes.
  • Student demonstrates correct Python indentation to keep commands inside loop structures.
  • Student combines two loops into a nested loop structure to process multiple laundry loads.
  • Student explains accurately what a for loop and a nested loop do.

Differentiation

Support

Have students write the sequential commands for one cycle before wrapping them inside a loop, verifying indentation line by line.

Stretch

Encourage students to optimize their vacuuming code on the large carpet to minimize the total number of lines used.

Knowledge check

5 questions to check understanding after the lesson. Tap an answer to see if it is right; the score appears at the end.

  1. 1What is the function of a for loop in Python?

  2. 2Why is indentation used with loops in Python?

  3. 3Which command tells the Agent to travel in a particular direction?

  4. 4What is a nested loop?

  5. 5How do students code the Agent to wash multiple loads of laundry in Activity 2?

Resources

Part of the Python 101 curriculum

This is lesson 5 of 10 in Python 101.

  1. Python 101 with MakeCode - Lesson 1
  2. Python 101 with MakeCode - Lesson 2
  3. Python 101 with MakeCode- Lesson 3
  4. Python 101 with MakeCode - Lesson 4
  5. Python 101 with MakeCode - Lesson 5
  6. Python 101 with MakeCode - Lesson 6
  7. Python 101 with MakeCode - Lesson 7
  8. Python 101 with MakeCode - Lesson 8
  9. Python 101 with MakeCode - Lesson 9
  10. Python 101 with MakeCode - Lesson 10

Frequently Asked Questions

What age group is this lesson intended for?

This lesson is designed for students ages 11 to 18 and older, with supporting materials specifically aligned to computer science instruction for secondary students in grades 9 through 12.

Where can teachers find the student check questions for printing?

A printable version of the assessment questions is provided at the end of the educator guide found in the supporting files.

Adapted from Python 101 with MakeCode - Lesson 5 by Minecraft Education on Minecraft Education, last updated Feb 4, 2025. This classroom version, the timings and the quiz were written by 9Minecraft Education.

You May Also Like

9Minecraft Education is an independent teaching resource and is not affiliated with Mojang or Microsoft. Lesson plans here are our own classroom-ready adaptations; each one links to the original resource and credits its author. © 2026 9minecraft.net