๐Ÿ PyQuest๐Ÿ•ต๏ธ Game: Number Detective ยท ๐Ÿ” Step 3: Keep Guessing
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Step 3: Keep Guessing ๐Ÿ”

One guess and the game ends? That's the shortest game ever. ๐Ÿ˜… A real detective keeps working the case until they crack it.

A while loop repeats a block as long as something is true:

password = ""
while password != "banana":
    password = input("Password? ")
print("You're in!")

Read it out loud: while the password is not banana, keep asking. The moment it matches, Python jumps past the loop.

Notice the loop asks again at the end โ€” that's what keeps it going. And now that the game is a real challenge, that spy print has to go. ๐Ÿ™ˆ

Your mission

  1. Delete the line that reveals the secret โ€” no peeking!
  2. Wrap the clue part in while guess != secret:
  3. Inside the loop: print the clue, then ask for a new guess
  4. After the loop, print the victory message

Your code

Press โ–ถ Run to see what your code does!