Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Automobile service invoice (Python 3)

4.10 Program: Automobile service invoice (Python 3)

(4) Extend the program to allow the user to enter a dash (-), which indicates no service. (3 pts) 

Ex:

Need assignment help for this question?

If you need assistance with writing your essay, we are ready to help you!

OUR PROCESS

Order

Payment

Writing

Delivery

Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality

Select first service: Tire rotation
Select second service: -
Davy's auto shop invoice
Service 1: Tire rotation, $19
Service 2: No service
Total: $19

Here is my code:

# make a dictionary for Davy’s auto shop

davy_auto_services = {

  ‘Oil change’: 35,

  ‘Tire rotation’: 19,

  ‘Car wash’: 7,

  ‘Car wax’: 12

}   

print(“Davy’s auto shop services”)

for key, value in davy_auto_services.items():

  print(key, ‘– $’ + str(value))

print(”)

first_service = input(‘Select first service: n’)

print(”)

second_service = input(‘Select second service: n’)

print(”)

print(“nDavy’s auto shop invoicen”)

#make if statement to loop 

if first_service in davy_auto_services:

  print(‘Service 1:’, first_service + ‘, $’ + str(davy_auto_services[first_service]))

else:

  print(‘Service1: No service’)

#make if statement for sevice 2  

if second_service in davy_auto_services:

  print(‘Service 2:’, second_service + ‘, $’ + str(davy_auto_services[second_service]))     

else: 

  print(‘Service 2: No service’)

print(”)  

total = davy_auto_services.get(first_service) + davy_auto_services.get(second_service)

print(‘Total: $’+ str(total))

#t = 0

#if first_service == “No service”:

  #print(‘Total: $’ + str(t))

#elif second_service not in davy_auto_services:

  #print(‘Total: $’ + str(second_service_total))

Here is the error I get:

Traceback (most recent call last):

File “main.py”, line 31, in <module>

total = davy_auto_services.get(first_service) + davy_auto_services.get(second_service)

TypeError: unsupported operand type(s) for +: ‘int’ and ‘NoneType’

All the other code works fine except for the very last piece. I have no idea how to print only one price..

“Order a similar paper and get 15% discount on your first order with us
Use the following coupon
“FIRST15”

Order Now