In: Computer Science
You have been asked to create a python program that will ask the user how many tickets the user would like to purchase for graduation. The user will then choose the number of tickets needed and the program will list the cost of the tickets, a service fee, tax, and the total of the purchase.
Specifications:
Here is the code:
while(True):
try:
num_ticket = int(input('How many tickets you would like to purchase for graduation? '))
cost_ticket = 10 # assumption
service_fee = 2.5 * num_ticket
tax = 0.03 * cost_ticket
final_cost = (cost_ticket * num_ticket) + tax + service_fee
print('\nCost of one ticket: ' + "$" + str(cost_ticket))
print('Service fee: ' + "$" + str(service_fee))
print('Tax: ' + "$" + str(tax))
print('Final cost: ' + "$" + str(final_cost))
break
except ValueError:
print('Invalid input. Please input whole number only!\n')
Here is the output: