0%
⭐ 0 XPMap
Chapter 1 · Quest 5 of 5 · 15 XP

Snack Counter

🍿 A for loop repeats lines for you. range(1, 4) counts 1, 2, 3: it stops just before the second number.

for n in range(1, 4):
    print("Step", n)
print("Done!")
Step 1
Step 2
Step 3
Done!

Lines indented under the loop repeat. The line back at the left edge runs once, after the loop. Finish this one and your bot earns its first badge: Power On.

Instructions

  1. Use a for loop with range(1, 6).
  2. Inside the loop, print Snack and the number: Snack 1 up to Snack 5.
  3. After the loop, print Crunch complete! once, as the last line.
💡 Hint

for n in range(1, 6): then, indented, print("Snack", n). Then, back at the left edge, print("Crunch complete!").

Ask the community

bot.py
Terminal
← BackNext →

Chapter 1: Hello, Bot

The full quest map

Talk it out

  1. Read the instruction with the ✗ out loud.
  2. Say what your code does, line by line, as if to a friend.
  3. Find the line where what it does and what you want split apart.
  4. Press Run and read the terminal. Is that what you expected?
  5. Still stuck? Press Ask Pip why, or peek at the solution.
  6. Or ask on the community help board: say which quest, and paste your code.
New badge!

Your bot just got a new part. See it on the quest map.

Name your bot

It levels up as you play, and gets a new part with every chapter.