Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created January 15, 2021 04:50
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/7867521499993feb0bcda16afa64739f to your computer and use it in GitHub Desktop.
Save codecademydev/7867521499993feb0bcda16afa64739f to your computer and use it in GitHub Desktop.
Codecademy export
#Ground shipping rates
def ground_rates(weight):
if weight <= 2:
cost = weight* 1.5 + 20
return cost
elif (weight > 2) and (weight <= 6):
cost = weight* 3 + 20
return cost
elif (weight > 6) and (weight <= 10):
cost = weight*4 + 20
return cost
else:
cost = weight*4.75 + 20
return cost
#Primium shipping flat rate
primium_ground_shipping = 125.00
#Drone rates
def drone_rates(weight):
if weight <= 2:
cost = weight* 4.50
return cost
elif (weight > 2) and (weight <= 6):
cost = weight* 9.00
return cost
elif (weight > 6) and (weight <= 10):
cost = weight*12.00
return cost
else:
cost = weight*14.25
return cost
#Best shipping option determiner
def best_option(weight):
if (primium_ground_shipping() < ground_rates()) and (primium_ground_shipping() < drone_rates()):
cost = 125.00
print('Go primium for $' + str(cost))
elif (ground_rates() < primium_ground_shipping()) and (ground_rates() < drone_rates()):
cost = ground_rates()
print('Go ground for $' + str(cost))
else:
cost = drone_rates()
print('Go drone for $' +str(cost))
best_option(4.8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment