top of page

Python program to count vowels in a given sentence

Writer's picture: Priyanshu KanadePriyanshu Kanade

In this program we will take input sentence from the user and count the vowels occurrence in the given sentence from the user.

sentence = input("enter the sentence ")
string = sentence.lower()
print(string)
count = 0
list1 = ["a","e","i","o","u"]
for char in string:
   if char in list1:
      count = count+1
print("number of vowels in given sentence is",count)      

Output:

enter the sentence hello welcome to programmers door
hello welcome to programmers door
number of vowels in given sentence is 11 
 

Happy Coding!

Follow us on Instagram @programmersdoor

Join us on Telegram @programmersdoor


Please write comments if you find any bug in above code/algorithm, or find other ways to solve the same problem.

Follow Programmers Door for more.

17 views0 comments

Recent Posts

See All

Comments


bottom of page