Problem in Sal's Shipping PROJECT

Why am I getting an error despite copying the solution video ?
https://www.codecademy.com/paths/build-chatbots-with-python/tracks/introduction-to-python-and-chatbots/modules/learn-python3-control-flow/projects/sals-shipping

my code:

def cost_ground_shipping(weight):
  if weight <= 2.00:
    cost = (weight * 1.50) + 20.00
    return cost
  elif weight > 2.00 and weight <=  6.00:
    cost = (weight * 3.00) + 20.00
    return cost
  elif weight > 6.00 and weight <=  10.00:
    cost = (weight * 4.00) + 20.00
    return cost
  else:
    cost = (weight * 4.75) + 20.00
print(cost_ground_shipping(8.4,))

cost_premium_ground_shipping = 125.00

def cost_drone_shipping(weight):
  if weight <= 2.00:
    cost = (weight * 4.50)
    return cost
  elif weight > 2.00 and weight <=  6.00:
    cost = (weight * 9.00)
    return cost
  elif weight > 6.00 and weight <=  10.00:
    cost = (weight * 12.00) + 20.00
    return cost
  else:
    cost = (weight * 14.25)
print(cost_drone_shipping(1.5,))

def cheapest_method(weight):
  ground = cost_ground_shipping(weight)
  premium = cost_premium_ground_shipping
  drone = cost_drone_shipping(weight)
  
  if ground < premium and ground < drone:
    method = 'standard shipping'
    cost = ground
  elif premium < ground and premium < drone:
    method = 'premium shipping'
    cost = premium
  else:
      method = 'drone'
      cost = drone
  print('the cheapest option is $%.2f with %s shipping'%  (cost, method))
cheapest_method(50.3)

Please correct my mistake and help me understand

Hello @chip8499984088. Do you return cost in the else blocks for both cost_ground_shipping()' and cost_drone_shipping`?

3 Likes

Thank You @codeneutrino for pointing it out. I forgot to do that and was scratching my head for hours. thank you again

2 Likes