edit global variable in function python code example
Example 1: how to make variable global in python
global variable
variable = 'whatever'
Example 2: global var in python
a = input('Hello: ')
if a == 'world':
global b
b = input('Here')
print b
#Prints the input for be as a result
Example 3: how to declare global variable in python
global n
n = 'whatever'
Example 4: how to global variables in python
def Takenin():
global ans
ans = "This is the coorect way to do it"
def Return():
Takenin()
print(f"ans :{ans}")