python tip

Simplify an "if statement"

Sometimes you have to verify multiple values. What's the method you use? This one seems legit, right?

if a == 1 or a == 3 or a == 5 or a == 7:

Guess what, you can also do it like this:

if a in [1,3,5,7]:

This method makes it much easier to understand the condition, resulting in a readable code.