The Tech Platform

Aug 11, 20221 min

Program to Count the Number of Vowels in String in Python

Program to Count the Number of vowels we’re going to check how many vowels are present in a given String . There are five vowels– a, e, i, o, u.

Algorithm

Step 1:- Start.

Step 2:- Take user input.

Step 3:- Initialize count variable.

Step 4:- Iterate through the string to find number of vowels.

Step 5:- Check if the alphabet of the string lies under the group of vowels.

Step 6:- If TRUE increment count by 1.

Step 7:- Print count.

Step 8:- End.

Flow Chart

Code:

String = input('Enter the string :')
 
count = 0
 

 
String = String.lower()
 
for i in String:
 
if i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u':
 
#if True
 
count+=1
 

 
if count == 0:
 
print('No vowels found')
 
else:
 
print('Total vowels are :' + str(count))

Output:

The Tech Platform

www.thetechplatform.com

    0