In this blog post, you are going to learn to write a function that takes a character and returns TRUE if it is a vowel, otherwise false.
Program To Find Vowel Using For Loop In Python Programming Language:
Source Code:
def find_vowel(s):
l={‘a’,’e’,’i’,’o’,’o’,’u’}
for i in s:
if i in l:
print(‘TRUE’ , i , ‘is a vowel’)
else:
print(‘FALSE’, i , ‘is a vowel’)
print(“Enter the Statements : “)
s=input()
find_vowel(s)
Python Program Explanation:
In the above Python program first,
We have declared Function before that def keyword is used,
- def is used to declare a function.
- find_vowel is the name of the function.
- (s) is a function parameter.
- l={‘a’ , ‘e’ , ‘i’ , ‘o’ , ‘u’} it is a set of elements that stored in variable l.
After that, we have used For Loop in that,