Why is there a "None" in the output even when its correct. anyone wanna help me out

def ground_shipping(weight):

if weight <= 2:
price_per_pound = 1.50
elif weight <= 6:
price_per_pound = 3.00
elif weight <= 10:
price_per_pound = 4.00
else:
price_per_pound = 4.75
return (weight * price_per_pound) + 20

premium_ground_shipping = 125

def drone_shipping(weight):
if weight <= 2:
price_per_pound = 4.50
elif weight <= 6:
price_per_pound = 9.00
elif weight <= 10:
price_per_pound = 12.00
else:
price_per_pound = 14.25
return weight * price_per_pound

def cheapest_shipping(weight):
ground = ground_shipping(weight)
premium = premium_ground_shipping
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 available is %.2f with %s shipping.”
%(cost,method)
)

print(cheapest_shipping(8.4))

it shows:
The cheapest option available is 53.60 with Standard Ground shipping.
None

Well you are printing whatever the function cheapest_shipping returns. But your function returns nothing so “None” is being printed.

2 Likes

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.