Escape Room Program – Part 2: making decisions

Step 1 – Solving problems

When you ran your program you should have noticed two things:

  1. if you enter "Light" or "LIGHT" it doesn't work – only if you enter "light" all in lower case letters;
  2. the question only gets asked once

We'll solve these problems in the next two steps.

Solving the LIGHT problem

The problem is that, for Python, "LIGHT", "Light" and "light" are all different things. For you they all mean the same thing, but not for Python.

Solving this is dead easy.

Code helper image
  1. CHANGE your line of code with the input on to say:
    action = input("> ").lower()
  2. This converts whatever the player types in to lower case letters. That means that "LIGHT" or "Light" become "light", so the IF line should now work
  3. Run your program: Run > Run Module and try entering "LIGHT". Python should now accept this

You can use .lower() on any input line just by adding it at the end. You can also use .upper() if you need to convert to upper case letters.