Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 4, 2019 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/c96883d8abc1645805ab5b549392ee94 to your computer and use it in GitHub Desktop.
Save codecademydev/c96883d8abc1645805ab5b549392ee94 to your computer and use it in GitHub Desktop.
Codecademy export
def ground_shipping(weight):
if weight <= 2:
return (weight*1.50) + 20.00
elif (weight > 2) and (weight <= 6):
return (weight*3.00) + 20.00
elif (weight > 6) and (weight <=10):
return (weight * 4.00) + 20.00
else:
return (weight * 4.75) + 20.00
print(ground_shipping(8.4))
premium_gs= 125.00
def drone_shipping(weight):
if weight <= 2:
return weight*4.50
elif (weight > 2) and (weight <= 6):
return weight*9.00
elif (weight > 6) and (weight <= 10):
return weight*12.00
else:
return weight*14.25
print(drone_shipping(1.5))
def shipping_dealFinder(weight):
cheapest_way =""
drone_2 = drone_shipping(weight)
thereal_ground = ground_shipping(weight)
if premium_gs < drone_2 and premium_gs < thereal_ground:
cheapest_way = "Premium ground shipping"
return cheapest_way +" "+"which costs"+ " "+str(premium_gs)
elif drone_2 < premium_gs and drone_2 < thereal_ground:
cheapest_way = "Drone shipping"
return cheapest_way+" "+ "which costs"+" "+ drone_2
else:
cheapest_way = "Ground shipping"
return cheapest_way+ "which costs"+" "+ thereal_ground
print("The cheapest shipping method for a 4.8 pound package is using"+" "+ str(shipping_dealFinder(4.8)))
print("The cheapest shipping method for a 41.5 pound package is using"+" "+ str(shipping_dealFinder(41.5)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment