PREREQUISITES
To Practice this Program, you should have a basic knowledge of the following Topics:
WHAT TO DO ?
Ask the Website User for any statement and count the each vowel(a,e,i,o,u) present in it.:
HOW TO DO ?
Following are the steps to do :
</p>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>print("Write a statement to know how many vowels it includes ? ")
line = input("").lower()
</pre>
</div>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>
a = line.count("a")
e = line.count("e")
i = line.count("i")
o = line.count("o")
u = line.count("u")
</pre>
</div>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>vowels = a + e + i + o + u
print("Above statement includes " + str(vowels) + " vowels in total. ")</pre>
</div>
Things We Covered
- Accepting User Data (Input Function)
- Counting the vowels (String Methods – Count)
- Print/Output the Data (Print Function)
Posted by Akshay Gupta
