Ticket price
Ticket price
Read age with int(input()), then read yes or no for membership: member = input() == "yes" stores True or False. Members pay 5. Everyone else pays 12, or 8 if they are under 18. Print the price.
Order matters: test member first, so a 12-year-old member still pays 5. An 18-year-old is not under 18.
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.
Dificuldade 2/5 · Moedas 140 + pequeno bônus na primeira conclusão hoje
Read age with int(input()), then read yes ou no for membership and store member = input() == "yes". Members pay 5. Everyone else pays 12, or 8 if they are under 18. Print the price.
Clique em Executar para ver a saída aqui.