set global variable python in function code example
Example 1: how to make variable global in python
global variable
variable = 'whatever'
Example 2: global variable python
a = 0
def testFor():
global a
if(a == 0):
#run code
global variable
variable = 'whatever'
a = 0
def testFor():
global a
if(a == 0):
#run code