Using Global Variables in Functions
Python working with global variables
# Referencing a global variable inside a function
count = 1
def func():
"""
This function would increament the value of count by 1
Basically we just added 1 to the count variable
"""
# specifies that we might change the value of count
global count
count += 1
return count
print(func.__doc__)Last updated