Python Control Exercise: I NEED HELP

Hi Guys

For the data science path; python control section, I am doing a python control activity. I am stuck on the 6th instruction because at the end of my code when I call the function to find the cheapest option, nothing is printed on the screen. Can anybody identify anything wrong with my code? I have a link to my exercise. Thanks Ben.

https://www.codecademy.com/paths/data-science/tracks/dspath-functions-and-logic/modules/dspath-control-flow/projects/sals-shipping

1 Like

Thanks for the link. We will however need your code, also, since we cannot see it in our own profile. Please post the code in a reply. Thanks.

1 Like
def ground_shipping(weight):

  if weight <=2:
   return (1.5*weight)+20
  elif weight<=6:
   return (3*weight)+20
  elif  weight<=10:
   return (4*weight)+20
  else:
    return (4.75*weight)+20
  

print(ground_shipping(8.4))

premium_ground_shipping=125

def drone_shipping(weight):
 
  if weight <=2:
   return (4.5*weight)
  elif weight<=6:
   return (9*weight)
  elif  weight<=10:
   return (12*weight)
  else:
    return (14.25*weight)
  
print(drone_shipping(1.5))

def cheapest_shipping_method(weight):
  ground=ground_shipping(weight)
  drone=drone_shipping(weight)
  premium=premium_ground_shipping

  if ground<drone and ground<premium:
   method= 'standard ground'
   cost=ground
  elif drone<ground and drone<premium:
    method="standard drone"
    cost=drone
  elif premium<ground and premium<drone:
    method="premium"
    cost=premium
    
    print("cheapest option available is $.2f% with %s shipping." %(cost,method))
 
cheapest_shipping_method(4.8)

Perhaps unindent the print statement so it is not nested in the last elif.