what global inside funcitono pyton means code example
Example 1: global variables python
global x
x=1
Example 2: global in python
x = 5
def foo():
global x = 10
print("local x:", x)
foo()
print("global x:", x)
global x
x=1
x = 5
def foo():
global x = 10
print("local x:", x)
foo()
print("global x:", x)