I have problem which cannot fix. I get the error
UnboundLocalError: local variable 'checking' referenced before assignment
My code
def volume_checker_first_stage(volume1,volume2,withdraw_minimun):
if volume1>volume2:
quantity = volume2
if quantity > withdraw_minimun:
checking = True
return quantity, checking
elif volume2>volume1:
quantity = volume1
if quantity > withdraw_minimun:
checking = True
return quantity, checking
else:
return None,None
As the first line of the body of your function, code this:
checking = False
You have a return
statement that returns the value of checking
, but your code doesn't always set it. Referenced before assignment
means your return
statement asked for the value of the variable before your code assigned it.