Hi I have been trying to figure out how to remove whitespace from my output on t
ID: 3890116 • Letter: H
Question
Hi I have been trying to figure out how to remove whitespace from my output on this assignment and cannot figure this out. Any advise would be greatly appreciated! What am I missing or doing wrong here?
**First**
For example the output I get:
Service 1: Oil change ,$35
Service 2: Car wax , $12
I need to get rid of the whitespace between oil change and the comma.
**Second**
I am unable to get double space between these to lines:
Select second service:
**What I entered:**
#Davy's auto shop invoice
#part 1
print("Davy's auto shop services")
print("Oil change -- $35")
print("Tire rotation -- $19")
print("Car wash -- $7")
print("Car wax -- $12")
#part2
firstService=input(" Select first service: ")
secondService=input(" Select second service: ")
print(" Davy's auto shop invoice")
totalCharge=0
if firstService=="Oil change":
print(" Service 1:",firstService, ','"$35")
totalCharge+=35
elif firstService=="Tire rotation":
print(" Service 1:",firstService, ',' "$19")
`enter code here` totalCharge+=19
elif firstService=="Car wash":
print(" Service 1:",firstService, ',' "$7")
totalCharge+=7
elif firstService=="Car wax":
print(" Service 1:",firstService,',' "$12")
totalCharge+=12
else:
print(" Service 1: No service")
if secondService=="Oil change":
print("Service 2:",secondService,", $35")
totalCharge+=35
elif secondService=="Tire rotation":
print("Service 2:",secondService,", $19")
totalCharge+=19
elif secondService=="Car wash":
print("Service 2:",secondService,", $7")
totalCharge+=7
elif secondService=="Car wax":
print("Service 2:",secondService,", $12")
totalCharge+=12
else:
print("Service 2: No service")
print(" Total: $"+str(totalCharge))
4.10 Program: Automobile service invoice (Python 3) (1) Output a menu of automotive services and the corresponding cost of each service. (2 pts) Ex: Davy's auto shop services Oil changeS35 Tire rotation -- $19 Car wash$7 Car wax $12 (2) Prompt the user for two services from the menu. (2 pts) Ex: Select first service: Oil change select second se (3) Output an invoice for the services selected. Output the cost for each service and the total cost. (3 pts) Davy's auto shop invoice Service 1: 0il change, $35 Service 2: Car wax, $12 Total: $47 (4) Extend the program to allow the user to enter a dash (), which indicates no service. (3 pts) Ex: Select first service: Tire rotation Select second service: Davy's auto shop invoice Service 1: Tire rotation, $19 Service 2: No service Total: $19Explanation / Answer
Adding a backspace character ('') solves the issue. Here the modified program.