-
-
Save codecademydev/e41efd541bd47219b561a992485663a4 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 cost_ground_shipping(weight): | |
if weight<=2: | |
return 1.5*(weight) + 20 | |
elif weight<=6: | |
return 3*(weight) + 20 | |
elif weight<=10: | |
return 4*(weight) + 20 | |
else: | |
return 4.75*(weight) + 20 | |
#print(cost_ground_shipping(8.4)) | |
def cost_drone_shipping(weight): | |
if weight<=2: | |
return 4.5*(weight) + 0 | |
elif weight<=6: | |
return 9*(weight) + 0 | |
elif weight<=10: | |
return 12*(weight) + 0 | |
else: | |
return 14.25*(weight) + 0 | |
def cheapest(weight): | |
method3 = 125 | |
method2 = cost_drone_shipping(weight) | |
method1 = cost_ground_shipping(weight) | |
if method1<method2 and method1<method3: | |
print("Ground") | |
elif method2<method3 and method2<method1: | |
print("Drone") | |
elif method3<method1 and method3<method2: | |
print("Premium") | |
print(cheapest(1.8)) | |
print(cheapest(4.8)) | |
print(cheapest(41.5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment