Feb-19-2018, 10:53 PM
Hi I am using Python 3.6.2 I used a def so it would be easier to use this timer but my code doesn't seem to work can someone help me. I also showed the error that I am getting when I type "mycounter(10)"
def mycounter(time): for x in range(1, time): print(count) count = count + 1 time.sleep(1) if count == time: count = 0
Error:Traceback (most recent call last):
File "<pyshell#74>", line 1, in <module>
mycounter(10)
File "<pyshell#73>", line 3, in mycounter
print(count)
UnboundLocalError: local variable 'count' referenced before assignment