Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # count vowels in word
- from random import randint
- def count(vowels, word):
- vowel = [0, 0, 0, 0, 0]
- for letter in word:
- if letter == vowels[0]:
- vowel[0] += 1
- elif letter == vowels[1]:
- vowel[1] += 1
- elif letter == vowels[2]:
- vowel[2] += 1
- elif letter == vowels[3]:
- vowel[3] += 1
- elif letter == vowels[4]:
- vowel[4] += 1
- return vowel
- word = "occurrences"
- vowels = "aeiou"
- number_vowels = count(vowels, word)
- print("The word "+ word+ " contains")
- for i in range(5):
- x = i -1
- print(number_vowels[x], vowels[x])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement