KnowledgeBoat Logo

Computer Science

Write a program that inputs a line of text and prints out the count of vowels in it.

Python

Python String Manipulation

28 Likes

Answer

str = input("Enter a string: ")
count = 0

for ch in str : 
    lch = ch.lower()
    if lch == 'a' \
       or lch == 'e' \
       or lch == 'i' \
       or lch == 'o' \
       or lch == 'u' :
       count += 1

print("Vowel Count =", count)

Output

Enter a string: Internet of Things
Vowel Count = 5

Answered By

9 Likes


Related Questions