Build Your First AI Agent / Chapter 1: Hello, Bot
Feedback
Quest

03. 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.

Solution
battery = 15
if battery < 20:
    print("Low power...")
else:
    print("Feeling great!")
Still stuck?

Press "Talk it out" at the top. Our Discord opens soon; until then email us and paste your code.

Chapter quests
  1. Chapter 1: Hello, Bot
    1. Wake Up 10 XP
    2. Name Tag 10 XP
    3. Mood Ring 10 XP
    4. Echo Echo 10 XP
    5. Snack Counter 15 XP
  2. Chapter 2: Talk to the Model
  3. Chapter 3: Tools CLUB
  4. Chapter 4: Memory CLUB
  5. Chapter 5: Loops and Plans CLUB
  6. Chapter 6: Party of Agents CLUB
bot.py
Terminal
Chapter 1: Hello, BotQuest 3 / 510 XPBackNext

Talk it out

  1. What did you expect your bot to do?
  2. What did it actually print? Read the terminal, line by line.
  3. What's different? Spelling, capitals, spaces and full stops all count.
  4. Is there an error? It tells you the line number. Look there first.
  5. Read the instructions again, one at a time. Each one is checked on its own.

Badge unlocked:

Your bot got a new part. Chapter complete!

Make your bot

Pick a name and a colour. You can change them later.