SDD · Revision Project · Review

Leisure Centre Booking Adviser

Refresh the brief and rules before you reopen PyCharm

Recap

What was this project?

Purpose
The purpose of the program is to help a visitor choose a leisure centre activity, check they are eligible, apply the correct discount and display a clear booking summary.

You built this entirely with techniques from SDD1–SDD8. No loops, arrays, lists or user-defined functions were needed — and today, none are used either.

Techniques this project uses
variables int() / float() concatenation len() / slicing upper() / lower() if / elif / else and / or / not input() / print()

If any of these feel rusty, that's exactly what today is for.

Recap

Activity and price rules

ActivityStandard priceEntry rule
Swimming£8Open to everyone
Climbing£12At least 10 years old AND at least 140 cm tall
Skating£10At least 8 years old
Climbing needs both conditions true (AND). Skating and swimming only ever check one thing.
Recap

Discount and booking code rules

Junior or senior discount
Visitors aged 15 or under OR aged 65 or over receive £2 off.
Member discount
Other eligible visitors who are members receive £1 off.
Booking code
First three letters of the fictional name in uppercase, followed by the age. TestUser, age 14 → TES14.
Invalid choices
An activity other than swimming, climbing or skating must produce a clear error message.
⚠️ Read the discount rules again carefully: a visitor only ever gets one discount, never both. The word "Other" in the member rule means it only applies when the junior/senior discount didn't already apply.
Worked Walkthrough

Trace it through — Test 1

Test data
Name TestUser · Age 14 · Height 145 cm · Member no · Activity climbing
Eligibility: climbing needs age ≥ 10 AND height ≥ 140. 14 ≥ 10 ✓ and 145 ≥ 140 ✓ → eligible.
Discount: age 14 ≤ 15 → the junior/senior discount applies (£2 off). Membership doesn't matter here — the age discount already applies.
Price: standard price £12, minus the £2 discount = £10.
Booking code: first three letters of "TestUser" in uppercase = TES, plus the age = TES14.
Your Turn

Predict it yourself

New test data — not one of your six
Name TestUser · Age 65 · Height 150 cm · Member yes · Activity climbing

Before you click reveal: is this visitor eligible? What price do they pay? What's their booking code? Work it out first.

Eligible: 65 ≥ 10 and 150 ≥ 140 ✓
Discount: age 65 ≥ 65 → junior/senior discount applies (£2 off) — the age discount wins even though they're a member
Price: £12 − £2 = £10
Code: TES65
Common Mistakes

Syntax errors to check for

Mistake 1
Missing int()
✗ age = input("Age: ")
✓ age = int(input("Age: "))
Comparing a string to a number (e.g. age >= 10) crashes the program. Cast every number input.
Mistake 2
= instead of ==
✗ if activity = "swimming":
✓ if activity == "swimming":
Single = assigns a value. Double == compares. Python won't even run with a single = in an if.
Mistake 3
Capital AND / OR
✗ if age >= 10 AND height >= 140:
✓ if age >= 10 and height >= 140:
The brief writes AND/OR in capitals for readability — Python keywords must be lowercase.
Common Mistakes

Logic bugs to watch for

1️⃣ Stacking both discounts — applying the £1 member discount on top of the £2 age discount. The rules only ever give one discount per visitor.
2️⃣ Showing a price for an ineligible visitor — if the eligibility check fails, no price or booking code should be displayed at all.
3️⃣ Missing or misplaced invalid-activity check — any activity that isn't swimming, climbing or skating must trigger the clear error message, not a blank or incorrect result.
These won't crash your program the way syntax errors do — the program will run, but produce the wrong answer. This is why testing against the six expected results matters so much.
Before You Start

Your checklist

  1. 1Reopen leisure_centre.py in PyCharm.
  2. 2Run it for all six compulsory tests on the project page, using TestUser each time.
  3. 3Compare your actual results to the expected results table.
  4. 4Anything doesn't match? Check the syntax and logic mistake slides above before asking for help.
  5. 5Finished and all six pass? Try Extension 1 (Safer names) or Extension 2 (Weekend promotion) only.
Summary

What to remember

1
This project only ever needed selectionif / elif / else and complex conditions with and / or.
2
A visitor gets at most one discount — read "Other eligible visitors" carefully.
3
Testing against known expected results is how you catch logic bugs that don't crash the program.
Today: consolidate SDD1–8. Next lesson: SDD9 — Fixed Loops, starting fresh.
Slide 1 of 10