🌀 Year 5 · Syntax Station
Secret Galactic
Code Academy
Student Workbook
🌀 Syntax Station — Loops & Variables

Year Group: Year 5 · Ages 9–10

Theme: Loops, Variables, Lists & Nested Loops

Missions: 10 Workbook Missions · 16 Game Missions

Language: Python 3

© 2026 InfiniCoreCipher — FutureTechEducation | Canon Authority: Katarzyna Kalina vel Kalinowska | v3.0 MASTER CANON LOCKED
🔄

Zone 1: Loop Station

Advanced FOR Loops · Accumulators · WHILE Loops

Mission 1: Advanced FOR Loops CONCEPT
Year 5 Chapter 1 ⏱ 20 min ⭐ 110 XP
🚀
Nova says:

Welcome to Syntax Station, Captain! Here loops become POWERFUL! range(start, stop, step) gives you total control — even counting backwards!

📝 Activity 1.1 — range() Explorer

Write what each range() produces:

range() callNumbers producedCount
range(5)
range(1, 6)
range(0, 10, 2)
range(10, 0, -1)
range(1, 20, 3)
📝 Activity 1.2 — Countdown Timer

Write a FOR loop that counts down from 10 to 1, then prints "BLAST OFF! 🚀"

# Countdown from 10 to 1 for i in range( , , ): print(i) print(" ")

Expected output:

⭐ Activity 1.3 — Triangle Pattern

Use a FOR loop to print this triangle pattern:

* ** *** **** *****

Your code:

# Triangle pattern for i in range( ): print( )
🤖
Chip's Hint:

range(1, 6) gives 1, 2, 3, 4, 5. Use "*" * i to print i stars!

Mission 2: FOR Loop with Accumulator CONCEPT
Year 5 Chapter 1 ⏱ 20 min ⭐ 120 XP
🚀
Nova says:

An accumulator collects values as the loop runs! Start at 0, add to it each time. It's like a running total!

📝 Activity 2.1 — Trace the Accumulator

Trace through this code and fill in the table:

total = 0 for i in range(1, 6): total = total + i print("i =", i, "total =", total) print("Final total:", total)
Iterationitotal (before)total (after)
110
22
33
44
55

Final total:

📝 Activity 2.2 — Sum of 1 to 100

Write code to calculate the sum of all numbers from 1 to 100:

# Sum of 1 to 100 total = for i in range( , ): total = total + print("Sum:", total)

Answer: The sum of 1 to 100 =

⭐ Star Challenge — Factorial!

Calculate 5! (5 factorial = 5 × 4 × 3 × 2 × 1). Hint: Start your accumulator at 1, not 0!

# 5 factorial result = for i in range( , ): result = result i print("5! =", result)

5! =

Mission 3: Advanced WHILE Loops LOGIC
Year 5 Chapter 2 ⏱ 25 min ⭐ 130 XP
🚀
Nova says:

WHILE loops keep going while the condition is True! Perfect when you don't know how many times to repeat!

📝 Activity 3.1 — Trace the WHILE Loop
x = 1 while x <= 32: x = x * 2 print(x)
Iterationx (before)x (after)Condition (x ≤ 32)?
11
2
3
4
5
📝 Activity 3.2 — FOR or WHILE?

Choose the best loop type for each task:

TaskFOR or WHILE?Why?
Print numbers 1 to 10
Keep asking for password until correct
Process each item in a shopping list
Count down from unknown number to 0
Print the 12 times table
⭐ Activity 3.3 — Find First Divisible

Write a WHILE loop to find the first number greater than 100 that is divisible by both 7 AND 11:

# Find first number > 100 divisible by 7 AND 11 num = while not ( ): num = num + print("Found:", num)

Answer:

Zone 2: Control Station

break · continue · Lists · Slicing

Mission 4: break and continue CODING
Year 5 Chapter 2 ⏱ 25 min ⭐ 140 XP
🚀
Nova says:

break exits the loop immediately! continue skips the rest of this iteration and goes to the next! Powerful tools!

📝 Activity 4.1 — Predict the Output

What does each program print? Write your answer:

for i in range(10): if i == 5: break print(i)

Output:

for i in range(10): if i % 2 == 0: continue print(i)

Output:

📝 Activity 4.2 — break vs continue
KeywordWhat it doesWhen to use it
break
continue
⭐ Star Challenge — Search with break

Write code to find the first number in range(1, 100) that is divisible by 13. Use break to stop when found:

# Find first number divisible by 13 for i in range( , ): if i % == 0: print("Found:", i)

Answer:

Mission 5: Lists — Store Multiple Values CONCEPT
Year 5 Chapter 3 ⏱ 25 min ⭐ 130 XP
🚀
Nova says:

A list stores MANY values! Like a variable that holds a whole collection. Index starts at 0 — the first item is list[0]!

📝 Activity 5.1 — List Indexing
planets = ['Syntax World', 'Algorithm Alley', 'Syntax Station', 'Debugging Dunes', 'Creativity Cluster']
ExpressionResult
planets[0]
planets[2]
planets[-1]
planets[-2]
len(planets)
📝 Activity 5.2 — List Methods

Complete the code to use each list method:

scores = [85, 92, 78, 95, 88] # Add a new score scores. (100) # Remove score 78 scores. (78) # Sort the list scores. () # Print the highest score print( (scores))
📝 Activity 5.3 — Loop Through a List

Write a FOR loop to print each planet with its index number:

planets = ['Syntax World', 'Algorithm Alley', 'Syntax Station'] # Print: "1. Syntax World", "2. Algorithm Alley", etc. for i, planet in enumerate(planets, ): print( )
🔬

Zone 3: Advanced Loop Lab

List Slicing · Nested Loops · Loops + Lists

Mission 6: List Methods and Slicing LOGIC
Year 5 Chapter 3 ⏱ 25 min ⭐ 140 XP
🚀
Nova says:

Slicing gets a portion of a list! list[start:stop] — the stop index is NOT included. list[::-1] reverses the whole list!

📝 Activity 6.1 — Slicing Practice
numbers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
SliceResult
numbers[2:5]
numbers[:3]
numbers[7:]
numbers[::2]
numbers[::-1]
numbers[1:8:3]
📝 Activity 6.2 — Sort and Reverse
scores = [45, 92, 67, 88, 23, 95, 71] # Sort ascending scores. () print(scores) # Output: # Reverse the sorted list scores. () print(scores) # Output: # Count how many times 88 appears print(scores. (88)) # Output:
Mission 7: Nested Loops CODING
Year 5 Chapter 4 ⏱ 30 min ⭐ 160 XP
🚀
Nova says:

Nested loops — a loop inside a loop! Total iterations = outer × inner. Perfect for 2D patterns and grids!

📝 Activity 7.1 — Trace the Nested Loop
for row in range(3): for col in range(3): print(row, col)

Fill in ALL outputs (9 lines total):

📝 Activity 7.2 — Star Grid

Write nested loops to print a 5×5 grid of stars:

# 5×5 star grid for row in range( ): for col in range( ): print( , end= ) print() # new line after each row

Expected output:

* * * * * * * * * * * * * * * * * * * * * * * * *
⭐ Star Challenge — Multiplication Table

Write nested loops to print the 5×5 multiplication table:

# 5×5 multiplication table for i in range(1, ): for j in range(1, ): print(i * j, end= ) print()
Mission 8: Loops and Lists Together CODING
Year 5 Chapter 4 ⏱ 30 min ⭐ 160 XP
🚀
Nova says:

Loops + Lists = POWER! Build lists with loops, process lists with loops. This is where real programming begins!

📝 Activity 8.1 — Build a List with a Loop

Complete the code to build a list of squares (1², 2², 3², ... 10²):

# Build list of squares squares = for i in range(1, ): squares. (i * i) print(squares)

Output:

📝 Activity 8.2 — Filter a List

Write code to create a new list containing only scores above 20:

scores = [15, 25, 8, 32, 19, 28, 11, 35, 22, 7] # Filter: keep only scores > 20 high_scores = [] for score in : if score 20: high_scores. (score) print(high_scores)

Output:

⭐ Activity 8.3 — Grade System

Write a complete grade system that processes a list of scores:

scores = [85, 92, 67, 45, 78, 95, 55, 88] # Count grades grade_a = 0 # 90+ grade_b = 0 # 80-89 grade_c = 0 # 70-79 grade_f = 0 # below 70 for score in scores: if score >= : grade_a += 1 elif score >= : grade_b += 1 elif score >= : grade_c += 1 else: grade_f += 1 print(f"A: {grade_a}, B: {grade_b}, C: {grade_c}, F: {grade_f}")

Output:

📁 Portfolio Challenge

Create your own program that uses loops AND lists to solve a real problem. Ideas: shopping list calculator, quiz score tracker, favourite planets list. Save it to your portfolio!

🏆

Final Quest: Power the Syntax Station!

Use ALL your loop and list skills to restore power!

Mission 10: FINAL QUEST — Power the Syntax Station! FINAL
Year 5 Chapter 5 ⏱ 60 min ⭐ 500 XP
🚀
Nova says:

This is your greatest challenge yet — but you have ALL the skills you need! Break it into parts. Solve one part at a time. This is YOUR moment, Captain!

🏆 Part 1: Fix the Nested Loop Power Grid

This nested loop has 3 bugs. Find and fix them:

# BUGGY CODE — find and fix 3 bugs for row in range(4) for col in range(4): if row = col: print("⚡", end=" ") else print("·", end=" ") print()

Bug 1:

Bug 2:

Bug 3:

Fixed code:

🏆 Part 2: Power Level Tracker

Write code to track power levels across 5 zones:

# Power level tracker power_levels = [] for zone in range(1, 6): level = zone * + power_levels. (level) print("Power levels:", power_levels) print("Total power:", (power_levels)) print("Average power:", (power_levels) / (power_levels))
🏆 Part 3: Find Low-Power Zones

Write code to find all zones with power below 50:

power_levels = [45, 72, 38, 91, 55, 29, 83, 47, 66, 31] low_power = [] for i, level in enumerate(power_levels): if level < : low_power. (i + 1) # zone number (1-indexed) print("Low power zones:", low_power)

Output:

🏆 Part 4: Pattern Generator

Write nested loops to generate this power grid pattern:

1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25
🏆 Part 5: Master Control Loop

Write a complete program that uses a WHILE loop to keep asking for power readings until the user types "DONE", then calculates the average:

🏆
SYNTAX STATION POWERED UP!

You've mastered loops, variables, lists, and nested loops!

Debugging Dunes awaits, Admiral! 🔬

🏅 Year 5 Master
🌀 Syntax Station Champion
⭐ 500 XP Earned

Accumulator

A variable that collects values as a loop runs (e.g., running total).

break

Exits a loop immediately, even if the condition is still True.

continue

Skips the rest of the current iteration and goes to the next one.

FOR loop

Repeats a block of code a set number of times or for each item in a sequence.

Index

The position of an item in a list. Starts at 0 in Python.

Iteration

One complete run through a loop body.

List

A collection of values stored in a single variable, e.g., [1, 2, 3].

Nested loop

A loop inside another loop. Total iterations = outer × inner.

range()

Generates a sequence of numbers. range(start, stop, step).

Slicing

Getting a portion of a list: list[start:stop:step].

WHILE loop

Repeats while a condition is True. Use when you don't know how many times.

enumerate()

Returns both the index and value when looping through a list.