How to use global variable in python?

Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the python program.
e.g.,
def demo(): print(a) a = "Python" demo()

e.g.,
x= 5 y = 20 def multiply(): z = x * y print(z) multiply()

This is all about global variables in python.
Subscribe
Login
Please login to comment
0 Discussion