1

I am new to python and am attempting to call on "i" in my while loop and I declared the variable on line 1. I've read a lot on the call stack, so I thought the order here was okay.

Code

I'm getting

Traceback (most recent call last):
  File "ex33.py", line 14, in <module>
    mathtime()
  File "ex33.py", line 6, in mathtime
    while i < j:
UnboundLocalError: local variable 'i' referenced before assignment

Any help or pointer in the general direction would be awesome!

Maicon Mauricio
  • 2,052
  • 1
  • 13
  • 29

1 Answers1

0

Add the following to the top of your function:

global i, j
N. Kern
  • 401
  • 2
  • 7