My method is being recognized within my own program. Newbie mistake probably.

Posted by Sergio Tapia on Stack Overflow See other posts from Stack Overflow or by Sergio Tapia
Published on 2010-03-21T23:47:19Z Indexed on 2010/03/21 23:51 UTC
Read the original article Hit count: 441

Filed under:
|
|
|

Here's my code:

sentenceToTranslate = raw_input("Please write in the sentence you want to translate: ")
words = sentenceToTranslate.split(" ")

for word in words:
    if isVowel(word[0]):
        print "TEST"


def isVowel(letter):
    if letter.lower() == "a" or letter.lower() == "e" or letter.lower() == "i" or letter.lower() == "o" or letter.lower() == "u":
        return True
    else:
        return False

The error I get is:

NameError: name 'isVowel' is not defined

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about python

Related posts about newbie