Editor

Cinema Ticket Price

#503 · Python Basics · Beginner · Find and fix · 25 XP · about 3 min

A cinema charges by age. Children under 12 pay 5 dollars, people aged 65 or older pay 6 dollars, and everyone else pays 10 dollars. ticket_price(age) should return the price as a whole number.

The code in the editor runs, but it has two bugs. The box office has had complaints: a 12-year-old was charged the child price, and a 65-year-old was charged 10 dollars. Find the mistakes and fix them.

Examples

ticket_price(8)   # returns 5
ticket_price(12)  # returns 10
ticket_price(40)  # returns 10
ticket_price(65)  # returns 6

Note

age is a whole number, 0 or more.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.