Escape Room Program – Part 2: making decisions

Step 5 – Open the door

Your program should work so far. But it's not finished yet!

It leaves the player in an empty room with a door in it.

What next? Makes sense to open the door to me...

  1. Code helper imageYou'll be adding code to the end of your program here. It will need another while loop
  2. The first thing to do is to set  move_on  back to  False  so that we can use this to control the next while loop
  3. Then add the next while loop. This goes all the way to the left of the code because it's a new loop.

    This time I'm being more complicated.

    • if the player says "open" I want to tell them they can't
    • if they say "look" I want to tell them what it says on the door
    • if they say anything else I want to tell them they can't do that

    The elif line means "else if". This lets me do more than one thing inside the if. Which is really handy

    Do you see that I put the question and input inside the loop this time? This saves me having to ask the question twice.

  4. Run your program and test it.
  5. Code helper imageAh, a problem: you get stuck in the loop. No matter what you do, you can't get out of the loop
  6. Kill the program: File > Close and say Yes

We'll need to solve the riddle...