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