Problem 125902 · easy · Phase 01 Prerequisites & Setup

Cinema Ticket Price

conditionals · boolean flags

A cinema charges by age, with a discount for daytime (matinee) screenings. Write ticket_price(age, is_matinee):

  • children (under 13) pay 8,
  • seniors (65 and over) pay 9,
  • everyone else pays 12.

If is_matinee is True, take 3 off whichever price applies.

Examples

Input:  age = 30, is_matinee = False
Output: 12

Input:  age = 10, is_matinee = True
Output: 5

Input:  age = 70, is_matinee = False
Output: 9

Constraints

  • 0 <= age <= 120
  • is_matinee is a boolean

Goals

  • Pick a base price with if/elif/else
  • Apply an extra rule controlled by a boolean parameter
Starting Python…