This is my code:
# normal_ground_shipping
def normal_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
return 20 + price_per_pound* weight
print(normal_ground_shipping(8.4))
# premium_ground_shipping
premium_ground_shipping = 125
# drone_shipping
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))
# function that chooses the cheapest method of shipping:
def cheapest_method(weight):
ground = normal_ground_shipping(weight)
premium = premium_ground_shipping
drone = drone_shipping(weight)
if ground < premiun and ground < drone:
method = "standard ground method"
cost = ground
elif premium < drone:
method = "premium ground method"
cost = premium
else:
method = "drone method"
cost = drone
#print the result
print(
"%s is the cheapest one, it would cost $%.2f to ship a package weights % pounds sing this method."
%(method, cost, weight)
)
print(cheapest_method(4.8))
print(cheapest_method(41.5))
and the error message is:
Traceback (most recent call last):
File “script.py”, line 58, in
print(cheapest_method(4.8))
File “script.py”, line 40, in cheapest_method
if ground < premiun and ground < drone:
NameError: name ‘premiun’ is not defined
Can anyone help me to correct my codes? I thought I’ve already define the name ‘premium’ as I coded
premium = premium_ground_shipping
and
premium_ground_shipping = 125
Thanks for anyone for any tip or correction.