Say I have a bunch of variables that are either True
or False
. I want to evaluate a set of these variables in one if statement to see if they are all False
like so:
if var1, var2, var3, var4 == False:
# do stuff
Except that doesn't work. I know I can do this:
if var1 == False and var2 == False and var3 == False and var4 == False:
# do stuff
But that's fairly ugly - especially if these if statements are going to occur a lot in my code. Is there any sort of way I can do this evaluation with a cleaner syntax (like the first example)?