Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Count vowels in a given word (with repetition)
- english_vowels = ["a", "i", "e", "o", "u"]
- def vowel_count(word):
- vcount = 0
- for x in word:
- if x in english_vowels:
- vcount += 1
- print("vowel count> ",vcount)
- return vcount
- word= input("Enter a word > ") # notice this output is a string, hence iterable
- print( "'"+ word +"'"+ " has this many vowels: ",vowel_count(word))
- # Can also use a list of one-lettered strings (characters?)
- print(vowel_count(['a','b','e','s', 'e']))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement