-
-
Save codecademydev/38178d43b3817b535ac5d8a1e370a7d6 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_cost(weight): | |
if weight <= 2.00: | |
return (1.50 * weight) + 20.00 | |
elif weight >= 2.00 and weight <= 6.00: | |
return (3.00 * weight) + 20.00 | |
elif weight >= 6.00 and weight <= 10.00: | |
return (4.00 * weight) + 20.00 | |
elif weight >= 10.00: | |
return (4.75 * weight) + 20.00 | |
def drone_shipping_cost(weight): | |
if weight <= 2.00: | |
return (4.50 * weight) | |
elif weight >= 2.00 and weight <= 6.00: | |
return (9.00 * weight) | |
elif weight >= 6.00 and weight <= 10.00: | |
return (12.00 * weight) | |
elif weight > 10.00: | |
return (14.25 * weight) | |
def premium_shipping_cost(weight): | |
return 125.00 | |
ground = ground_shipping_cost(weight) | |
premium = premium_shipping_cost(weight) | |
drone = drone_shipping_cost(weight) | |
if ground < premium and ground < drone: | |
method = "ground shipping" | |
cost = ground | |
elif premium < ground and premium < drone: | |
method = "premium ground shipping" | |
cost = premium | |
else: | |
method = "drone shipping" | |
cost = drone | |
def print_cheapest_shipping_method(weight): | |
print("the cheapest option available is " + str(cost) + "dollars with " + str(method) + ".") | |
print_cheapest_shipping_method(4.8) | |
print_cheapest_shipping_method(41.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment