Can anyone please tell me what is wrong with this script. I am a python newb but i cant seem to figure out what might be causing it not to function.
def find_vowels(sentence):
"""
>>> find_vowels(test)
1
"""
count = 0
vowels = "aeiuoAEIOU"
for letter in sentence:
if letter in vowels:
count += 1
print count
if __name__ == '__main__':
import doctest
doctest.testmod()
Besides the fact that you’re returning a count but expecting a string of vowels, as others have said, you must also change the line
to
You forgot the quotes!