Here is an if
statement from a method I was making (never mind what it's for):
if str.lower(char) == "a" or str.lower(char) == "e" or str.lower(char) == "i" or str.lower(char) == "o" or str.lower(char) == "u":
There must be a shorter way to write this if
statement, right? Maybe something like:
if str.lower(char) == ("a" or "e" or "i" or "o" or "u"):
Is there a way to make equality (or any comparison for that matter) distribute among many terms in a similar way? It seems to me that something like this would make for easier to read code.
The in
keyword is designed for this sort of thing:
if str.lower(char) in "aeiou":
...