Python 3: UnboundLocalError: local variable referenced before assignment [duplicate] Python 3: UnboundLocalError: local variable referenced before assignment [duplicate] python-3.x python-3.x