I want to write code that will allow me to check condition only if we want to use that condition i.e
cond1 = True
cond2 = False
cond3 = True
use_cond1 = False
use_cond2 = True
use_cond3 = True
and now current code is
if cond1 and cond2 and cond3:
dosomething
I want to add check if we should use that condition for cond1
would be use_cond1
but if I write is as
if (cond1 and use_cond1) and cond2 and cond3:
dosomething
entire condition will be False
because we don't want to use cond1, is there an effective way to remove cond1 from if statement without writing each if statement manually? thank you