samedi 30 mai 2020

Syntax shorthand for comparison operator in python [duplicate]

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":

Aucun commentaire:

Enregistrer un commentaire