I’m trying to complete Sal’s shipping assignment for Python 3, which instructs us to create 3 functions to: 1) determine the cost of ground shipping 2) determine the cost of drone shipping 3) determine the cheapest shipping method.
Everything in my program went well until I tried to call function 3, which i named Cheapest_cost(weight). this function worked normally when using an argument <= 10, but it gave the error below when I used an argument > 10…
Traceback (most recent call last):
File “script.py”, line 45, in
File “script.py”, line 41, in Cheapest_cost
% (cost, method)
UnboundLocalError: local variable ‘cost’ referenced before assignment
Anyone know what the problem is?