Warm up: Automobile service cost
****(1) Prompt the user for an automobile service. Output the user's input. (1 pt)
Ex:
Enter desired auto service:
Oil change
You entered: Oil change
(2) Output the price of the requested service. (4 pts)
Ex:
Enter desired auto service:
Oil change
You entered: Oil change
Cost of oil change: $35
The program should support the following services (all integers):
-
Oil change -- $35
-
Tire rotation -- $19
-
Car wash -- $7
If the user enters a service that is not listed above, then output the following error message:
Error: Requested service is not recognized.****
1 Answer
service_choice = input('Enter desired auto service:\n')
print('You entered:', service_choice)
service_cost = 0
if service_choice == 'Oil change':
service_cost = 35
print(f'Cost of oil change: ${service_cost}')
elif service_choice == 'Tire rotation':
service_cost = 19
print(f'Cost of tire rotation: ${service_cost}')
elif service_choice == 'Car wash':
service_cost = 7
print(f'Cost of car wash: ${service_cost}')
else:
print('Error: Requested service is not recognized')