Ticket price
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
This one builds on a lesson you haven't finished yet. Do that lesson first:
Python Basics · Making decisions →
Ticket price
age is 30 and member is True. Members pay 5. Everyone else pays 12, or 8 if they are under 18. Store the price in price.
A True/False variable needs no comparison: if member: already asks the question. Writing if member == True: works too, but the short form is what you will see in real code.
age is 30 and member is True. Members pay 5. Everyone else pays 12, or 8 if they are under 18. Store the price in price.
Click Run to see the output here.