Codecademy export
def cost_of_ground(weight): | |
if weight<=2 : | |
price=1.5 | |
elif weight<2 and weight<=6: | |
price=3 | |
elif weight>6 and weight<=10: | |
price=4.0 | |
else: | |
price=4.75 | |
return 20+(weight*price) | |
print(cost_of_ground(8.4)) | |
def cost_of_drone(weight): | |
if weight<=2 : | |
price=4.5 | |
elif weight<2 and weight<=6: | |
price=9 | |
elif weight>6 and weight<=10: | |
price=12 | |
else: | |
price=14.25 | |
return weight*price | |
print(cost_of_drone(1.5)) | |
premium_ground=125.0 | |
def print_cheaphest_shiphing_method(weight): | |
ground=cost_of_ground(weight) | |
drone=cost_of_drone(weight) | |
premium=premium_ground | |
if ground < drone and ground < premium : | |
method="standard ground" | |
cost=ground | |
elif drone < ground and drone < premium : | |
method="drone transport" | |
cost=drone | |
else: | |
method="premium ground transport" | |
cost=premium | |
print("Best price for you is $%.2f with %s shiphing" | |
%(method,cost)) | |
print_cheaphest_shiphing_method(4.8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment