Source Code:
(back to article)
# Define a global variable global_var = "This is a global variable" def my_function(): # Access the global variable inside the function print("The global variable is:", global_var) my_function() # Output: The global variable is: This is a global variable
Result:
Report an issue