O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

7-5. Movie Tickets:

From

Cover of Python Crash Course

Note

prompt = '\nProgram to check ticket price**'
prompt += '\nEnter your age: '

while True:
age = raw_input(prompt)
if age == 'quit' or age == 'q':
break
else:
age = int(age)
if age <= 0 or age > 150:
print('age should in range [0, 150]')
continue
if age < 3:
fee = 0
elif age <12:
fee = 10
elif age < 150:
fee = 15

print(&quot;You&#39;d pay $&quot; + str(fee) + &quot; for ticket.&quot;)