Write a function, is_vowel that returns the value true if a given character is a vowel, and otherwise returns false. Write another function main, in main() function accept a string from user and count number of vowels in that string.

Source Code

def is_vowel(letter):
    if letter in 'aeiouAEIOU':
        return True
    else:
        return False

def main():
    count = 0
    string = input('Enter a text: ')
    for ch in string:
        if(is_vowel(ch)):
            count += 1

    print('Number of vowels are', count)

main()

Output

Enter a text: India is great
Number of vowels are 6