Question: Python My code all works but my total keeps ending up being $0. I think I'm doing something wrong and I can't figure it out.
Python
My code all works but my total keeps ending up being $0. I think I'm doing something wrong and I can't figure it out. I'm still new to this coding thing
#printing the menu item print ("Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12") #asking the user input first_service = input(" Select first service:") second_service = input(" Select second service:") #if user input = "-" adding no service if(first_service=='-'): first_service='No service' #otherwise it will check and assign price accordingly
if(first_service == 'Oil change'): first_service=first_service+", $35" elif first_service == 'Tire rotation': first_service=first_service+", $19" elif first_service == 'Car wash': first_service=first_service+", $7" elif first_service == 'Car wax': first_service=first_service+", $12" #for second service also #checking for "-" if not them #calculating price accordingly if(second_service=='-'): second_service="No service" if(second_service == 'Oil change'): second_service=second_service+", $35" elif second_service == 'Tire rotation': second_service=second_service+", $19" elif second_service == 'Car wash': second_service=second_service+", $7" elif second_service == 'Car wax': second_service=second_service+", $12" #printing the invoice print() print (" Davy's auto shop invoice ") print ("Service 1: "+first_service) print ("Service 2: "+second_service)
p1=0 p2=2
if(first_service=='No service'): p1 = 0 elif(first_service=='Oil change'): p1 = 35 elif(first_service=='Tire rotation'): p1 = 19 elif(first_service=='Car wash'): p1 = 7 elif(first_service=='Car wax'): p1 = 12 if(second_service=='No service'): p2 = 0 elif(second_service=='Oil change'): p2 = 35 elif(second_service=='Tire rotation'): p2 = 19 elif(second_service=='Car wash'): p2 = 7 elif(second_service=='Car wax'): p2 = 12
total = int(p1) + int(p2) print() print('Total: $',total)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
