In: Computer Science
Use the Design Recipe to write a function count_vowels, which consumes a string and returns the number of vowels in that string. For these purposes, the vowels are a, e, i, o, and u, but never y. Include a Docstring! Note: Count both upper and lowercase vowels! Write 3 assert_equal statements to test your function.
def count_vowels(message):
""" consumes a string and returns the number of vowels in that string"""
letter_list = list(message.lower())
"*** YOUR CODE HERE ***"
ans=0
vowel_list=['a','e','i','o','u']
for letter in letter_list:
if letter in vowel_list:
ans+=1
return ans
x=str(input("Enter String: "))
y=count_vowels(x)
print("the number of vowels in given string = "+str(y))
******************************************************************************************
PLEASE LIKE IT RAISE YOUR THUMBS UP
IF YOU ARE HAVING ANY DOUBT FEEL FREE TO ASK IN COMMENT
SECTION
******************************************************************************************