TORONTO KIDS COMPUTER CLUB | Thursday 18:30 Python Practice 22.05.12.
post-template-default,single,single-post,postid-20642,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Thursday 18:30 Python Practice 22.05.12.

13 May Thursday 18:30 Python Practice 22.05.12.

Question 1:
Write a program for a movie theater using while loop. It will keep asking your age and display the ticket price, until you enter “quit”. It is free if you are less than 3 years old, otherwise if your age is less than 16 years old or over 65 years old the ticket is $10, otherwise the price is $15. After quit, your program will print the total number of tickets sold and total amount of dollars income.

How old are you? 10
How old are you? 2
How old are you? 50
How old are you? 67
How old are you? quit
Total tickets sold: 4
Total income: $35

Question 2:
Martha takes a jar of quarters to the casino with the intention of becoming rich. She plays three machines in turn. Unknown to her, the machines are entirely predictable. Each play costs one quarter. The first machine pays 30 quarters every 35th time it is played; the second machine pays 60 quarters every 100th time it is played; the third pays 9 quarters every 10th time it is played.

Input Specification
Your program should take as input the number of quarters in Martha’s jar (there will be at least one and fewer than 1000), and the number of times each machine has been played since it last paid.

Output Specification
Your program should output the number of times Martha plays until she goes broke.

Sample Input

Sample Output
Martha plays 66 times before going broke.
No Comments

Sorry, the comment form is closed at this time.