Counting vowels

Posted by user74283 on Stack Overflow See other posts from Stack Overflow or by user74283
Published on 2010-05-28T02:52:10Z Indexed on 2010/05/28 3:01 UTC
Read the original article Hit count: 243

Filed under:

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)
    e

    """

    count = 0
    vowels = "aeiuoAEIOU"
    for letter in sentence:
        if letter in vowels:
            count += 1
    print count

if __name__ == '__main__':
    import doctest
    doctest.testmod()

© Stack Overflow or respective owner

Related posts about python