-
-
Save codecademydev/eec3c04a98bc2c20ad313996651f109b 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_of_gs(weight): | |
if weight <= 2: | |
price_per_lb = 1.5 | |
elif weight <= 6: | |
price_per_lb = 3 | |
elif weight <= 10: | |
price_per_lb = 4 | |
else: | |
price_per_lb = 4.75 | |
return (weight * price_per_lb) + 20 | |
print(cost_of_gs(8.4)) | |
cost_of_pgs = 125 | |
def cost_of_ds(weight): | |
if weight <= 2: | |
price_per_lb = 4.5 | |
elif weight <= 6: | |
price_per_lb = 9 | |
elif weight <= 10: | |
price_per_lb = 12 | |
else: | |
price_per_lb = 14.25 | |
return (weight * price_per_lb) | |
print(cost_of_ds(1.5)) | |
def cheapest_method(weight): | |
ground = cost_of_gs(weight) | |
premium = cost_of_pgs | |
drone = cost_of_ds(weight) | |
if ground < premium and ground < drone: | |
method = "standard ground." | |
cost = ground | |
elif premium < ground and premium < drone: | |
method = "premium ground." | |
cost = premium | |
else: | |
method = "drone." | |
cost = drone | |
print("the cheapest option available is " + str(cost) + " with " + method) | |
print(cheapest_method(4.8)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment