Check and Count Vowels in word (Functions in Python)

Here, we will pass a word as parameter to a method which will return the number of vowels present in the same.

# creating a function which will check and count number of vowels
def vowels_count(input_string):
    # creating list of all vowels(UPPER and lowercase both)
    my_vowels = ['a','A','e','E','i','I','o','O','u','U']
    count = 0 # initialize count with zero
    #iterate the string for getting each letter
    for each_letter in input_string:
        # conditional statement to check for vowels(using list)
        if each_letter in my_vowels:
            # increase count by one each time when a vowel is found
            count = count + 1
        # adding else part to deal with any spaces provided
        elif each_letter == ' ':
            continue
    # return the count
    return count

# call the function, passing a string in parameter
number_of_vowels = vowels_count('readability counts')
# storing count value into a variable
print(f'Total number of vowel(s) in the word(s) = {number_of_vowels}')

# fun examples you should try
word_full_of_vowels = 'QUEUEING'
word_with_no_vowel = 'RHYTHMS'