──────────────────────────────────────

7. The Club Pass Desk · Open the Right Door

Use a comparison and indentation to control which instructions run.

Lesson files · lessons/input-and-decisions/booleans-and-if

Before you start
- Read a whole number with int(input()).
- Recognise the values True and False.

By the end
- Use if and else to choose one message from a comparison.
- Test the cutoff and the score just below it.

Where you can use it
Show a different message when a player reaches the score needed for the next level. Test the score that opens the level.

A comparison such as score >= 5 gives True when the score is 5 or higher. The colon ends the if line, and the lines indented under it run when the condition is True. Put else at the same indentation level as if. Its own indented lines run when the condition is False.

To check another condition in the same chain, add an elif between if and else. The next lesson uses that pattern for three pass tiers.

Predict
Does >= 5 include a score of exactly 5?
- Yes.
- No.

Worked example (example.py)

score = int(input())
if score >= 5:
    print("Open")
else:
    print("Keep practising")


Example input
5

Example result
Open

Print Go! when the score is at least 8. Print Try again. for a smaller score.

Starter program (starter.py)

score = int(input())
if score >= 5:
    print("Open")
else:
    print("Keep practising")


Starter input
5

Hint
Put exactly one print in each branch. Use >= so the boundary is included.

Case 1. Try the sample
Input
8
Expected output
Go!

Case 2. Just below the cutoff
Input
7
Expected output
Try again.

Stretch
Add a separate message for 10 or more using if, elif and else.

Reflect
Which output tells you that 7 and 8 fell into different branches?

Check your prediction
Yes. The equals part of >= includes the boundary.
