Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created May 25, 2020 19:48
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/05065715e5d34f534d270b1c5178f430 to your computer and use it in GitHub Desktop.
Save codecademydev/05065715e5d34f534d270b1c5178f430 to your computer and use it in GitHub Desktop.
Codecademy export
premium_shipping= 125.00
def ground_shipping(weight):
if weight<=2 :
return "The cost is "+ str(20.00 + weight* 1.50)
elif weight>2 and weight<=6 :
return "The cost is "+ str(20.00 + weight *3.00)
elif weight>6 and weight<=10 :
return "The cost is "+ str(20.00 + weight*4.00)
else :
return "The cost is "+ str(20.00 + weight*4.75)
def drone_shipping(weight):
if weight<=2 :
return "The cost is "+ str(0.00 + weight* 4.50)
elif weight>2 and weight<=6 :
return "The cost is "+ str(0.00 + weight *9.00)
elif weight>6 and weight<=10 :
return "The cost is "+ str(0.00 + weight*12.00)
else :
return "The cost is "+ str(0.00 + weight*14.25)
def cheapest_method(weight):
gs=float(ground_shipping(weight))
ds=float(drone_shipping(weight))
ps=float(125.00)
if gs < ds and gs < ps:
return "The cheapest method is the ground shipping with the cost "+ str(gs)
if ds < gs and ds < ps:
return "The cheapest method is the drone shipping with the cost "+ str(ds)
else:
return "The cheapest method is the drone shipping with the cost "+ str(ps)
print(ground_shipping(8.4))
print(drone_shipping(1.5))
print(cheapest_method(4.8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment