-
-
Save codecademydev/e67073e9659d104bb605d416f31ab6a9 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): | |
flat_cost = 20 | |
price_per_pound = 1.50 | |
premium_ground_shipping = 125 | |
if weight <= 2: | |
return (weight * price_per_pound) + flat_cost | |
elif weight > 2 and weight <= 6: | |
return (weight * (price_per_pound * 2)) + flat_cost | |
elif weight > 6 and weight <= 10: | |
return (weight * (price_per_pound * 2 + 1)) + flat_cost | |
else: | |
return (weight * (price_per_pound * 2 + 1.75)) + flat_cost | |
#print (cost_ground_shipping (8.4)) | |
def cost_drone_shipping (weight): | |
price_per_pound = 4.50 | |
if weight <= 2: | |
return (weight * price_per_pound) | |
elif weight > 2 and weight <= 6: | |
return (weight * (price_per_pound * 2)) | |
elif weight > 6 and weight <= 10: | |
return (weight * (price_per_pound * 2 + 3)) | |
else: | |
return (weight * (price_per_pound * 2 + 5.25)) | |
#print (cost_drone_shipping (1.5)) | |
def customer_info (weight): | |
premium_ground_shipping = 125 | |
if cost_ground_shipping (weight) < cost_drone_shipping (weight) and cost_ground_shipping (weight) < 125: | |
print ("Ground shipping is cheapest at $" + str(cost_ground_shipping (weight))) | |
elif cost_drone_shipping (weight) < cost_ground_shipping (weight) and cost_drone_shipping (weight) < 125: | |
print ("Drone shipping is cheapest at $" + str(cost_drone_shipping (weight))) | |
else: | |
print ("Premium Ground shipping is the cheapest at $125") | |
print (customer_info (41.5)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment