Python program to count vowels in a given sentence

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.

#blog #interview #placement #learn #computer #science

16 views

        Contact Us

programmersdoor@gmail.com

  • LinkedIn
  • Facebook
  • Instagram

©2023 by Programmers Door