ERROR HELP: Local variable 'shipping' referenced before assignment


def main():

#Have user enter value of order
value = float(input('Enter the value of your order:'))
#Determine if shipping applies
if value >= 100.00:
    print('Congratulations! You qualify for free shipping.')
    weight = int(input('Enter the weight of your order:'))

#Determine shipping cost
    if weight >= 40:
       shipping = weight * 1.09
    elif weight >= 20:
       shipping = weight * 0.99
        shipping = weight * 0.89

#Determine total price
print('Shipping cost is: $',format(shipping,'.2f'),sep='')


When value is >= 100.00, then shipping should be free. Print ('Congratulations! You quality for free shipping.').
This message does display, but then I get the following message thereafter; (local variable 'shipping' referenced before assignment) ---- I am stuck here. How can I fix this issue? Thanks everyone!

Replace this line with your code.


your format() is still looking for shipping, but it undefined.