-
-
Save codecademydev/7867521499993feb0bcda16afa64739f to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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