lundi 13 août 2018

Multiple conditions python

I want to do a function that counts the consonants in a string, so I tried to do this:

def vowel count(foo):
  count = 0
  for i in foo:
    if not i == 'a' and i == 'e' and i ... and i == 'O' and i == 'U':
      count += 1
return count

But this is pretty ugly and tedious to do, more so with many more conditions. Is there any way to put them together?

Aucun commentaire:

Enregistrer un commentaire