I gave this following program in Python just to understand scopes of variables, but I'm getting the error:
count = 0
def hello_func():
if(count == 5):
return 0
print("Hello")
count+=1
hello_func()
hello_func()
Error :
UnboundLocalError: local variable 'count' referenced before assignment
Can you explain what I'm doing wrong? And how do I declare count has global variable without altering the structure of the above program?