
- Type
- Lesson plan
- Subject
- Computer Science & Coding
- Topics
- Computer Science
- Ages
- Ages 11-18
- Duration
- about 60 min (suggested)
How can programmers use while loops to repeat actions efficiently without knowing the exact number of repetitions in advance?
Overview
In this computer science lesson set within the Kingdom of the Floating Islands, students explore how to automate repetitive actions using Python. Building on previous foundational coding skills, learners discover how while loops allow a program to repeat commands dynamically until a target condition changes, eliminating the need to duplicate lines of code.
Working alongside their in-game Agent, students break down complex construction and repair challenges across four floating environments. By structuring commands in proper sequence and applying while loops, learners restore vital infrastructure and earn the credentials needed to complete the world.
Learning objectives
By the end of this lesson students will be able to:
- Distinguish between the purpose of a while loop and a for loop in Python.
- Apply decomposition to break down floating island challenges into manageable steps for the Agent.
- Sequence Python commands correctly so the Agent can navigate and complete designated tasks.
- Construct while loops that continue repeating actions as long as a specific condition is met.
Blocks and items used in this lesson
Key vocabulary
- While loop
- A programming command that repeats a block of code as long as a given condition remains true.
- For loop
- A loop structure typically used to repeat a set of actions a specific, predetermined number of times.
- Decomposition
- The process of breaking a complex problem down into smaller, easier-to-solve parts.
- Sequencing
- Arranging programming instructions in the exact order required for a computer or Agent to execute them successfully.
Before class
Lesson sequence
Suggested timing: about 60 minutes in total.
- Introduction & Concept Review10 min
Introduce the lesson by connecting back to Island 3. Explain that computers excel at rapid repetition and that programmers avoid copying and pasting code. Discuss the core concept of a while loop, contrasting loops that repeat while a condition holds true with fixed-count for loops.
- Coding Tasks: Infrastructure & Industry20 min
Have students load into Island 4 and summon their Agent. Guide them through the first two Python activities:
- Activity 1 (Distant Island Bridge): Use loop logic to guide the Agent across the gap and construct a bridge.
- Activity 2 (Mine Factory): Decompose extraction routines to automate mining operations.
- Coding Tasks: Nature & Flight20 min
Students continue their programming work through the remaining island locations:
- Activity 3 (Botanical Gardens): Program the Agent to handle maintenance routines in the gardens.
- Activity 4 (Airship Factory): Automate repairs on the airship to earn the Certificate of Airworthiness.
- Final Delivery & World Wrap-up10 min
Students take their Certificate of Airworthiness and deliver it to the Prime Minister inside the Parliament building to conclude the official storyline. Convene as a class to review how while loops made each Agent task more efficient than writing line-by-line commands.
Assessment: success criteria
- Student successfully constructs functional while loops to solve assigned Python tasks.
- The Agent completes all four island tasks: Distant Island Bridge, Mine Factory, Botanical Gardens, and Airship Factory.
- The learner collects the Certificate of Airworthiness and delivers it to the Prime Minister in the Parliament building.
- Student accurately explains during class discussion how a while loop repeats code based on conditions.
Differentiation
Provide scaffolding on breaking tasks into sequential steps and verify loop conditions before students run their Agent programs.
Students who complete the main tasks can freely explore the unlocked underground village beneath the kingdom.
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.
1What is the primary Python concept taught throughout Island 4?
Answer: B. The source explicitly states that Island 4 focuses on repeating sections of code specifically using while loops.
2How does a while loop decide whether to continue executing code?
Answer: C. A while loop is designed to repeat code as long as a specified condition remains true.
3Which helper character returns in this lesson to carry out student code?
Answer: D. The lead-in notes that the Agent returns from Island 3 to help students complete tasks.
4What must students do after repairing the airship to complete the world?
Answer: A. Once the airship is repaired, students must hand the Certificate of Airworthiness over to the Prime Minister in the Parliament building.
5What bonus area becomes accessible to students who finish their work early?
Answer: A. Finishing the final delivery unlocks a hidden underground village for early finishers to explore.
Resources
Part of the Python Island curriculum
This is lesson 4 of 6 in Python Island.
Frequently Asked Questions
Are there extra coding challenges in the unlocked underground village?
No. The source notes that while early finishers gain access to explore the hidden underground village, it contains no additional coding tasks.
Do students need to have completed Island 3 before starting Island 4?
While Island 4 builds directly on concepts and Agent familiarity from Island 3, students only need an understanding of basic sequencing and how to direct the Agent to begin working with while loops.
Adapted from Island 4 by Minecraft Education on Minecraft Education, last updated Mar 19, 2025. This classroom version, the timings and the quiz were written by 9Minecraft Education.




















