def shipping_cost_ground(weight):
if weight <= 2:
cost = 1.50
elif weight <= 6:
cost = 3.00
elif weight <= 10:
cost = 4.00
else:
cost = 4.75
return 20 + (weight * cost)
premium_shipping = 125.00
def shipping_cost_drone(weight):
if weight <= 2:
cost = 4.50
elif weight <= 6:
cost = 9.00
elif weight <= 10:
cost = 12.00
else:
cost = 14.25
return weight * cost
def cheapest_shipping_method(weight):
ground = shipping_cost_ground(weight)
premium = premium_shipping
drone = shipping_cost_drone(weight)
if ground < premium and ground < drone:
method = "standard ground"
price = ground
elif premium < ground and premium < drone:
method = "premium"
price = premium
else:
method = "Drone"
price = drone
print("The cheapest shipping option available is " + str(price) + "$ with " + str(method) + " shipping.")
print(cheapest_shipping_method(100))
It prints this:
The cheapest shipping option available is 1425.0$ with premium shipping.
None
how come?