From Plan to Code 🛠️

How to write the logic for Scenario 1 (Library Age Limit 5-18)

The Rule: If the age is between 5 and 18 (inclusive), they can join. Otherwise, show an error.

Pseudocode

Cambridge IGCSE Style

EXAM STYLE
OUTPUT "Please enter your age:"
INPUT UserAge

IF UserAge >= 5 AND UserAge <= 18
  THEN
    OUTPUT "Welcome to the library!"
  ELSE
    OUTPUT "Sorry, invalid age."
ENDIF

Python 3

Actual Implementation

PYTHON
# Get input and convert to Integer
age = int(input("Enter age: "))

if age >= 5 and age <= 18:
    print("Welcome to the library!")
else:
    print("Sorry, invalid age.")

Key Differences to Remember:

Mastering this layout will help you ace your Paper 2 exam! 📝✨