Tickets at Different Prices

Python for AIEasy+10 XP+10

Tickets at Different Prices

A cinema sells tickets. The Ticket class in the starter code gives every ticket its full price. Don't change it.

Write two children of Ticket that each override price():

  • ChildTicket: price() returns half of base. For example, a base of 9 gives 4.5.
  • SeniorTicket: price() returns base - 4, but never less than 0.

Neither child needs an __init__ of its own. A plain Ticket should still return its full base.

Examples

ChildTicket(12).price()
returns 6.0
SeniorTicket(10).price()
returns 6

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run