1.Count how many vowels (a, e, I, o, u) in a word.
Code:
import random
import string
word = ""
for i in range(20):
word += random.choice(string.ascii_lowercase)
print(word)
# write your code here
import random
import string
word = ""
for i in range(20):
word += random.choice(string.ascii_lowercase)
print(word)
chars = ['a', 'e', 'I', 'o', 'u']
count = 0
for i in word:
if i in chars:
count += 1
print(f'Total vowels (a, e, I, o, u): {count}')
Comments
Leave a comment