How to Test Multiple Variables Against a Single Value and a Single Variable Against Multiple Values in Python
Posted by Al Sweigart in misc
Python has a more concise syntax that uses the in
operator and the multiple values packaged in a tuple. To check if one of multiple variables is one of many values, you can use a list comprehension and the any()
function.