i need to change CHECKER value to 1 but i cant.
NUM0 = 0
CHECKER = 0
def ITEM():
if CHECKER == 0 :
NUM1 = NUM0
CHECKER = 1
CodePudding user response:
If I understood you correctly, just change the last line to this:
CHECKER = 1
CodePudding user response:
Take CHECKER as a global variable inside function
NUM0 = 0
CHECKER = 0
def ITEM():
global CHECKER #this will solve your problem
if CHECKER == 0 :
NUM1 = NUM0
CHECKER = 1
CodePudding user response:
Declare your variable global
to modify it:
NUM0 = 0
CHECKER = 0
def ITEM():
global CHECKER # <- HERE
if CHECKER == 0 :
NUM1 = NUM0
CHECKER = 1
CodePudding user response:
You don't call your function. This will work for you:
NUM0 = 0
CHECKER = 0
def ITEM():
if CHECKER == 0 :
NUM1 = NUM0
CHECKER = 1
ITEM()