0%
⭐ 0 XPPractice
Pack 1 · Challenge 3 of 5 · 10 XP · ⏱ 4 min

Password Gate

🔐 Bots guard doors too. Compare text with ==: one equals sign sets a variable, two compare.

answer = input("Ready? ")
if answer == "yes":
    print("Let's go!")
else:
    print("Take your time.")

When you press Run, a box asks you for the password. When you Submit, the checker tries the right password and a wrong one.

Instructions

  1. Ask input("Password: ") and store it in guess.
  2. If guess is open sesame, print Welcome in!
  3. Otherwise print Nope. Try again.
💡 Hint

if guess == "open sesame": then print("Welcome in!"), and under else: print("Nope. Try again.").

Ask the community

bot.py
Terminal
← BackNext →

Python Warm-ups

All practice packs

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.