When I call this function, it does not take the data input into account. Why is this?

https://www.codecademy.com/paths/build-chatbots-with-python/tracks/introduction-to-python-and-chatbots/modules/learn-python3-control-flow/projects/sals-shipping

def shipcost(weight):
  
  ground = cost_normgrndship(weight)
  drone = cost_dronegrndship(weight)
  premium = prem_grndship
  
  if ground < drone and ground < premium:
    method = "standard ground"
    cost = ground
  if drone < ground and drone < premium:
    method = "drone"
    cost = drone
  else:
    method = "premium ground"
    cost = premium
  
  print("The cheapest shipping option is " + method + " which costs "+ str(cost) + ".")

When i try to call shipcost(4.8) and shipcost(41.5) it just prints out “The cheapest shipping option is premium ground which costs 125” twice. What am I doing wrong?

Hi @marelise, welcome to the Codecademy Forums!

Take a closer look at your if-else loop and I think you’ll see what the problem is. If you can’t figure it out after a second look, I’ve singled out the problematic code below.

Click here
if drone < ground and drone < premium:
    method = "drone"
    cost = drone
3 Likes

Wow, that mistake was even simpler than I thought. Lol. Thanks for the help!

1 Like