Python Essentials · 18 min · 170 XP

Checkpoint: fare calculator

Combine values, functions and conditionals in a fresh problem with almost no starter code.

This is a mastery checkpoint, not another worked example. Start from the brief, run small cases, and use the hint only after you have a plan. Getting stuck is useful evidence about what to revisit.

Before coding, turn prose into cases. Write down the normal price, each discount, and the boundary values where the answer changes. For this task those boundaries include ages 12, 13, 64 and 65. Tests love boundaries because that is where vague thinking becomes a bug.

Loading your workspace…