This code doesn't work on trinket

import random

import time

print(“:hatching_chick: Welcome to the Easter Egg Hunt! :hatching_chick:”)

print(“Find the correct egg… but beware of the WRONG one :smiling_face_with_horns::chicken:”)

print()

eggs = [“Egg 1”, “Egg 2”, “Egg 3”, “Egg 4”, “Egg 5”]

# Randomly choose the safe egg

safe_egg = random.choice(eggs)

while True:

print("Choose an egg:")

for egg in eggs:

    print("-", egg)



choice = input("Pick one (type Egg 1–5): ")



if choice not in eggs:

    print("❌ Invalid choice! Try again.\\n")

    continue



print("\\nYou open the egg...")

time.sleep(2)



if choice == safe_egg:

    print("🎉 YOU FOUND THE GOLDEN EGG! YOU WIN! 🎉")

    break

else:

    print("...")

    time.sleep(1)

    

    \# Jumpscare

    print("🐔💀 THE SCARY CHICKEN GOT YOU!!! 💀🐔")

    print(r"""

      (\\\_/)

     ( •\_•)

    / >🍗   BOO!!!

    """)

    print("\\nGame Over!\\n")

    

    play_again = input("Play again? (yes/no): ").lower()

    if play_again == "yes":

        safe_egg = random.choice(eggs)

        print("\\n--- New Game ---\\n")

    else:

        print("Thanks for playing!")

        break

Hi @Gghh45 and welcome to the forums.

You’ll notice that the code you posted is difficult to read. In particular it is difficult to see the loops and indenting. Here’s how to make it readable for everyone: Python Discourse Quick Start . You can probably edit your original post so as to make it look right.

In what way does it not work? If it stops on an error message, paste it in (like code). If it doesn’t do what you expect, show us an interaction.

Printing out repr(choice) and repr(safe_egg) just before if choice == safe_egg: would probably help you debug it. I suggest using the repr function because comparing strings is tricky. There can be spaces or new lines you don’t expect (and may not notice if you only print the string).