Sals Shipping error

weight = 8.4

#Ground Shipping

if weight <= 2:
ground_price = weight * 1.5 + 20
elif weight <= 6:
ground_price = weight * 3 + 20
elif weight <= 10:
ground_price = weight * 4 + 20
else weight > 10:
ground_price = weight * 4.75 + 20

print (“Ground Price” , ground_price)

getting a syntax error on line 10 pointing at weight, not sure why.

Conditions are required for if and elif statements, but you can’t specify a condition for else.
The last condition of your snippet should be elif weight > 10:

An else statement is not mandatory and can be omitted. However, if you want to execute some code when none of the conditions have been met, then an else is appropriate.

Thank you so much! I appreciate the help

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