Skip to content

Python code snippet – count How many vowels in a string ?

def vowel_count(string):
  vowels = ['a', 'e', 'i', 'o', 'u']
  return len([i for i in string if i in vowels])
See also  How to set the return value of a function in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.