-
-
Save codecademydev/0cc9d9be21b4cec8b4450cbade120e2d 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
def Ground_Shipping(weight): | |
cost = 0 | |
flat = 20 | |
if weight <= 2: | |
cost = (weight * 1.5) + flat | |
elif weight >= 2 and weight<= 6: | |
cost = (weight * 3) + flat | |
elif weight >= 6 and weight <= 10: | |
cost = (weight * 4) + flat | |
else: | |
cost = (weight * 4.75) + flat | |
print(cost) | |
return(cost) | |
def Drone_Shipping(weight): | |
costd = 0 | |
if weight <= 2: | |
costd = (weight * 4.5) | |
elif weight >= 2 and weight<= 6: | |
costd = (weight * 9) | |
elif weight >= 6 and weight <= 10: | |
costd = (weight * 12) | |
else: | |
costd = (weight * 14.25) | |
print(costd) | |
return(costd) | |
def compare(weight): | |
choice = "" | |
gs = Ground_Shipping(weight) | |
ds = Drone_Shipping(weight) | |
ps = 125 | |
if gs > ds and ps > ds: | |
choice = "The cheapest option for your package is Drone Shipping which will be " + str(ds) + " USD." | |
elif ds > gs and ps > gs: | |
choice = "The cheapest option for your package is Ground Shipping which will be " + str(gs) +" USD." | |
else: | |
choice = "The cheapest option for your package is Premium Shipping which will be " + str(ps) +" USD." | |
print(choice) | |
Ground_Shipping(8.4) | |
Drone_Shipping(1.5) | |
compare(41.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment