0%
⭐ 0 XPMap
Chapter 1 · Quest 3 of 5 · 10 XP

Mood Ring

💍 Bots make choices with if and else. If the test is true, the indented lines under if run. Otherwise the lines under else run.

coins = 3
if coins > 5:
    print("Shop time!")
else:
    print("Keep saving.")
Keep saving.

Put a colon at the end of the if and else lines, and 4 spaces before the lines inside them. < means "less than".

Instructions

  1. Write battery = 15 on its own line.
  2. If battery is less than 20, print Low power...
  3. Otherwise (else), print Feeling great! The checker also tries battery = 80.
💡 Hint

The test is battery < 20. Colon after the if line and after else. Indent each print by 4 spaces.

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.