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
- Use a
forloop withrange(1, 6). - Inside the loop, print
Snackand the number:Snack 1up toSnack 5. - 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!").
bot.py
Terminal