I actually don't have any question about my code but i use a ide named pycharm while running my code i don't get any error but my ide gives me a warning why is that so?
Here's my code :
def hi():
global d
d = 5
hi()
print(d)
My code works fine but my ide gives me a warning at line 2 of my code which is Global variable 'd' is undefined at the module level.
Did i do anything wrong in my code i just created a global variable through a function and accesed it outside the function.
does anyone know why this is happening?