Python Program to use a global variable with a function
In this program, you will learn how to use a global variable with a function in Python.
num = 10
def change():
global num
Example: How to use a global variable with a function in Python.
num = 10
def change():
global num
num = num + 10
print("Value is:", num)
change()
Output:
Value is: 20