Task: Write a Python String Program To Count Vowels – This python programming tutorial will explain how to find the number of vowels in a given string. The user will input the string at run time.
We will use simple if statement with logical operators and comprison operators. So that we can check whether a given character in the string is a vowl or not.
To get each character from string one by one we will use a for loop as it is used on collections.
The Source Code of Python String Program To Count Vowels
The output of this Vowel counter program is as follows:
Enter a string to find number of vowels:abcde
Total vowels in given string are: 2
Since there are only two vowels ‘a’ and ‘e’ in the string “abcde”.