I am using Python and I would like to have an if statement with many variables in it.
Such as:
if A, B, C, and D >= 2:
print (A, B, C, and D)
I realize that this is not the correct syntax and that is exactly the question I am asking — what is the correct Python syntax for this type of an if statement?
You want to test a condition for
allthe variables:This should be helpful if you’re testing a long list of variables with the same condition.
If you needed to check:
Then you want to test a condition for
anyof the variables: