Problem 199266 · easy · Phase 01 Prerequisites & Setup

Roller Coaster Admission

conditionals · boolean logic

A theme park lets someone on the roller coaster when they are at least 6 years old and either at least 140 cm tall, or at least 120 cm tall and accompanied by an adult. Write can_ride(height_cm, age, with_adult) that returns True or False.

Examples

Input:  height_cm = 150, age = 10, with_adult = False
Output: True

Input:  height_cm = 125, age = 8, with_adult = False
Output: False

Input:  height_cm = 125, age = 8, with_adult = True
Output: True

Constraints

  • 50 <= height_cm <= 250
  • 0 <= age <= 120
  • with_adult is a boolean

Goals

  • Mix and, or and not in one decision
  • Apply a rule that blocks every other rule
Starting Python…