I entered the following code
def ground_shipping(weight):
if weight <= 2:
price_per_pound = 1.5
elif weight <= 6:
price_per_pound = 3
elif weight <= 10:
price_per_pound = 4
else:
price_per_pound = 4.75
cost = (price_per_pound * weight) +20
return cost
print(ground_shipping(8.4))
premium_shipping_cost = 125.00
def drone_shipping(weight):
if weight <= 2:
price_per_pound = 4.5
elif weight <= 6:
price_per_pound = 9
elif weight <= 10:
price_per_pound = 12
else:
price_per_pound = 14.25
return price_per_pound * weight
print(drone_shipping(1.5))
def cheapest_shipping(weight):
ground = ground_shipping(weight)
premium = premium_shipping_cost
drone = drone_shipping(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 is $%.2f with %s shipping.”
% (cost, method)
)
print(cheapest_shipping(4.8))
print(cheapest_shipping(41.5))
and my result was as follows:
53.6
6.75
The cheapest option is $34.40 with standard ground shipping.
None
The cheapest option is $125.00 with premium ground shipping.
None
Could someone explain to me why ‘None’ is appearing in the result and how to remove it?