2. Phonics
Did you know that the first letters in the alphabet that a child learns are the vowels? Well, since they're the first letters that we learned as babies, then they must be easy to identify, right? So, let's make a code that will identify all vowels in a string and print out how many they are!
Let's go!
Input
A line containing a string.
CodeChum
Output
A line containing an integer.
3
Source code
vowels=['a','e','i','o','u']
str1=input("Enter a string: ")
str2=str1.lower()
count=0
for i in str2:
for v in vowels:
if (i==v):
count+=1
print(count)
Sample Output
Comments
Leave a comment