carPrice = input (“what is the base price of the car?”)
tax = int (carPrice) * .125
insurance = 250
totalcarPrice = int (carPrice) + int (insurance) + int (tax)
print (“total cost of your car including: insurance $”,insurance,”,”)
print (“and tax: $”,tax,” comes to $”,totalcarPrice)
input ()
This is a program that figures out all your extra costs, when buying a car.
The only mistake I still need to figure out, is what the escape clause is for avoiding having a space at the end of a statement inside a print function.
It works fine, the user enters the base cost for the car.
Program calculates the tax and adds a previously decided insurance cost.
Then the program provides the user with both the individual costs, and the total all-inclusive price of the car.
EDIT:
After some research not in-book, it turns out that you can avoid the white spaces in between statements by using the function sep = “”, which should be treated as a variable – so not inside the quotation marks of the print function, rather, naked inside the brackets.
So the final program now looks like this:
carPrice = input (“what is the base price of the car?”)
tax = int (carPrice) * .125
insurance = 250
totalcarPrice = int (carPrice) + int (insurance) + int (tax)
print (“total cost of your car including: insurance $”,insurance,”,”, sep = “”)
print (“and tax: $”,tax,” comes to $”,totalcarPrice, sep = “”)
input ()