Sal's shipping project - why is the math not working?

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

when i test just the method “shipping_cost_ground” it works great. the math is correct. but when i run it at the end, the math is now wrong (according to the project). the final method, when called, gives me $13.80, which is wrong. please help! thanks so much!

here’s my code:

def shipping_cost_ground(weight):
  if weight <= 2.0:
    return (weight * 1.5) + 20.0
  elif weight <= 6.0:
    return (weight + 3.0) + 20.0
  elif weight <= 10.0:
    return (weight * 4.0) + 20.0
  else:
    return (weight * 4.7) + 20.0

print(shipping_cost_ground(10))

shipping_cost_premium = 125.0

def shipping_cost_drone(weight):
  if weight <= 2.0:
    return weight * 4.5
  elif weight <= 6.0:
    return weight + 9.0
  elif weight <= 10.0:
    return weight * 12.0
  else:
    return weight * 14.25

print(shipping_cost_drone(1.5))

def method_cost(weight):
  ground = shipping_cost_ground(weight)
  premium = shipping_cost_premium
  drone = shipping_cost_drone(weight)
  
  if ground < premium and ground < drone:
    method = "Ground"
    cost = ground
  elif premium < ground and premium < drone:
    method = "Premium"
    cost = premium
  else:
    method = "Drone"
    cost = drone
  
  print("The best way to ship this package is %s. The cost will be $%s." % (method, cost))

method_cost(4.8)

Hello @shaunbarbour. The problem, for both the shipping_cost_drone and shipping_cost_ground functions is here:

For the shipping_cost_ground. And here

For the shipping_cost_drone. You are adding not multiplying on the return where you should be multiplying.
Happy coding!

1 Like

perfect! thanks so much!

1 Like