I have an if statement that wants to check:
if c=="a" or c=="e" or c=="i" or c=="o" or c=="w":
Is there a way to write this more efficiently so that I don't have to repeat c=="x" so much.
Something like if c=="a" or "e" or "i" or "o" or "w":
I have an if statement that wants to check:
if c=="a" or c=="e" or c=="i" or c=="o" or c=="w":
Is there a way to write this more efficiently so that I don't have to repeat c=="x" so much.
Something like if c=="a" or "e" or "i" or "o" or "w":
you can try any()
and all()
funcs. In your case
if any(c==l for l in ['a','e','o','w']):
# do stuff