Sal's Shipping Project - In my string which returns the final answer, my integers have spaces. How can I remove them?

The link to the exercise:

https://www.codecademy.com/courses/learn-python-3/projects/python-sals-shipping

So this is my code:

package_weight = 2

if package_weight <= 2:
cost_ground = package_weight * 1.5 + 20
elif package_weight <= 6:
cost_ground = package_weight * 3 + 20
elif package_weight <= 10:
cost_ground = package_weight * 4 + 20
elif package_weight > 10:
cost_ground = package_weight * 4.75 + 20

if package_weight <= 2:
cost_drone = package_weight * 4.5
elif package_weight <= 6:
cost_drone = package_weight * 9
elif package_weight <= 10:
cost_drone = package_weight * 12
elif package_weight > 10:
cost_drone = package_weight * 14.25

if cost_drone and cost_ground > 125:
print(“Ground Shipping Premium is the cheapest method of delivery at $125. Ground shipping = $”,cost_drone, “Drone shipping = $”, cost_drone,“.”)
elif cost_drone < cost_ground:
print(“We recommend Drone Shipping $”,cost_drone, “as it is cheaper than Ground Shipping $”,cost_ground, “& ground shipping premium $125.”)
else:
print (“We recommend Ground Shipping $”, cost_ground, “as it is cheaper than Drone Shipping $”, cost_drone, “and Ground Shipping premium $125.”)

The only problem I have is that there is a space between my cost_ground variables and cost_drone variables when the code is executed leaving a space like this $ 120, rather than $120, is there any way to remove this space?

Kind regards,

Geo

Can you please format your code so ppl can read it?

Try using + and str( ) instead of having each thing you want to display as a separate argument for print( ).

print("Ground Shipping Premium is the cheapest method of delivery at $125. Ground shipping = $" + str(cost_drone) + " Drone shipping = $" + str(cost_drone) + ".")

Or you could use use .format [for strings] or use an f-string for the argument for print( )

 
Alternatively, you could set the sep parameter/argument for the print function call to be an empty string.

print("Ground Shipping Premium is the cheapest method of delivery at $125. Ground shipping = $",cost_drone, "Drone shipping = $", cost_drone,".", sep="")

Excellent, thank you