Sal's Shipping

I have a huge problem with the objective “Sal’s Shipping” and been stuck for a long time. This was the first function I wrote without looking every step up. I thought it went very well but there is a line that always creates a syntax error… (I marked it down below.) Could someone quickly look into it? Would be greatly appreciated.


flat_charge = 20

def ground_shipping(weight):
cost = 20

if weight > 10:
cost = flat_charge + 4.75 * weight
elif weight > 6:
cost = flat_charge + 4.00 * weight
elif weight > 2:
cost = flat_charge + 3.00 * weight
else:
cost = flat_charge + 1.50 * weight

return cost

package_one = ground_shipping(8.4)
print(package_one)

cost_premium_groundshipping = 125.00

flat_charge = 0

def drone_shipping(weight):
cost = 20

if weight > 10:
cost = flat_charge + 14.25 * weight
elif weight > 6:
cost = flat_charge + 12.00 * weight
elif weight > 2:
cost = flat_charge + 9.00 * weight
else:
cost = flat_charge + 4.50 * weight

return cost

package_two = drone_shipping(1.5)
print(package_two)

def bestshippingmethod_price(weight):
if (drone_shipping(weight) < ground_shipping(weight)) and (drone_shipping(weight) < cost_premium_groundshipping):
print(“The cheapest method would be drone shipping. The delivery will cost you " + drone_shipping(weight) + " ." ) if (ground_shipping(weight) < drone_shipping(weight)) and (ground_shipping(weight) < cost_premium_groundshipping): print("The cheapest method would be ground shipping. The delivery will cost you " + ground_shipping(weight) + " .”)
if (cost_premium_groundshipping < drone_shipping(weight)) and (cost_premium_groundshipping < ground_shipping(weight)):
print(“The cheapest method would be premium ground shipping. The delivery will cost you " + cost_premium_groundshipping + " .") if drone_shipping(weight) == ground_shipping(weight): print("Ground shipping and drone shipping are the same price. The delivery will cost you " + drone_shipping(weight) + " .”
# line of problem (syntax error), I really don’t know what’s wrong here
if drone_shipping(weight) == cost_premium_groundshipping:
print(“Drone shipping and premium groundshipping are the same price. The delivery will cost you " + drone_shipping(weight) + " .") if ground_shipping(weight) == cost_premium_groundshipping: print("Ground shipping and premium groundshipping are the same price. The delivery will cost you " + ground_shipping(weight) + " .”

package_three = bestshippingmethod_price(4.8)
print(package_three)

With the quick look, I noticed that the last print statement is missing closing parentheses after the period. It should be print("Ground shipping and premium groundshipping are the same price. The delivery will cost you " + ground_shipping(weight) + " .”). However, I want to give you an advice: for better readability and speed of your program use f-string. For example, the above print statement can be re-written like so:

print(f"Ground shipping and premium groundshipping are the same price. The delivery will cost you {ground_shipping(weight)}.”)