0
How to create global variable in Pyhton and use this variable inside the function?
global variable
2 Answers
0
thank you
- 1
1 . any variable created outside any func. is a global by default...
2 . any variable declaired in any func. is a local variable...to use it/access it out side the func. or in other functions...u have to make it global..
example:
a=5
def hello() :
print(a)
global b
b=7
print(b) ## outside function; accessing b
>>> 5
7