print("Davy's auto shop services") print("Oil change -- $35") print("Tire rotation -- $19") print("Car wash -- $7") print("Car wax -- $12") print() service1=input("Select first service:") print() service2=input("Select second service:") print() dic={"Oil change":"35","Tire rotation":"19","Car wash":"7","Car wax":"12"} total = 0 print() print("Davy's auto shop invoice") print() for key,value in dic.items(): if(service1 == key): print("Service 1:",key+str(", $")+dic[key]) total = total + int(dic[key]) if(service2 == key): print("Service 2:",key+str(", $")+dic[key]) total = total + int(dic[key]) if(service1 == "-"): print("Service 1:", "No service") if(service2 == "-"): print("Service 2:", "No service") print() print("Total: $"+str(total)) Error : Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12 Select first service: Select second service: Davy's auto shop invoice Service 2: Car wax, $12 Service 1: No service Total: $12 it should output : Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12 Select first service: Select second service: Davy's auto shop invoice Service 1: No service Service 2: Car wax, $12 Total: $12
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
I need help with the last part of this code :
print("Davy's auto shop services")
print("Oil change -- $35")
print("Tire rotation -- $19")
print("Car wash -- $7")
print("Car wax -- $12")
print()
service1=input("Select first service:")
print()
service2=input("Select second service:")
print()
dic={"Oil change":"35","Tire rotation":"19","Car wash":"7","Car wax":"12"}
total = 0
print()
print("Davy's auto shop invoice")
print()
for key,value in dic.items():
if(service1 == key):
print("Service 1:",key+str(", $")+dic[key])
total = total + int(dic[key])
if(service2 == key):
print("Service 2:",key+str(", $")+dic[key])
total = total + int(dic[key])
if(service1 == "-"):
print("Service 1:", "No service")
if(service2 == "-"):
print("Service 2:", "No service")
print()
print("Total: $"+str(total))
Error :
Davy's auto shop services
Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12
Select first service:
Select second service:
Davy's auto shop invoice
Service 2: Car wax, $12
Service 1: No service Total: $12
it should output :
Davy's auto shop services
Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12
Select first service:
Select second service:
Davy's auto shop invoice
Service 1: No service
Service 2: Car wax, $12
Total: $12
print("Davy's auto shop services")
print("Oil change -- $35")
print("Tire rotation -- $19")
print("Car wash -- $7")
print("Car wax -- $12")
print(" press - if no service required")
service1=input("Select first service:")
service2=input("Select second service:")
dic={"Oil change":"35","Tire rotation":"19","Car wash":"7","Car wax":"12"}
total = 0
print("Davy's auto shop invoice")
for key,value in dic.items():
if(service1 == key):
total = total + int(value)
if(service2 == key):
total = total + int(value)
if(service1 == "-"):
print("Service 1:", "No service")
else:
print("Service 1:",service1+str("$")+dic[service1])
if(service2 == "-"):
print("Service 2:", "No service")
else:
print("Service 2:",service2+str("$")+dic[service2])
print("Total: $"+str(total))
OUTPUT:
Davy's auto shop services
Oil change -- $35
Tire rotation -- $19
Car wash -- $7
Car wax -- $12
press - if no service required
Select first service: -
Select second service: Car wash
Davy's auto shop invoice
Service 1: No service
Service 2: Car wash$7
Total: $7
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images