Hey guys i'm totally confused, every time i run my code i get this error message:
Oops, try again. Did you create a function called anti_vowel? Your code threw a "global name 'a' is not defined" error.
Here's my code:

def anti_vowel(text) :
    text = str(text)
    nwtxt = ""
    vowels = [a,e,i,o,u,A,E,I,O,U]
    for x in text:
        if x not in vowels:
            nwtxt += x
    return nwtxt

Could you please tell me what's wrong ?


Hi @whovian1969 ,

This is unnecessary, since the text parameter will already be a str ...

text = str(text)

What is the type of each of the items in this list? ...

vowels = [a,e,i,o,u,A,E,I,O,U]

Are they each intended to be a str? The Python interpreter will consider them to be undefined variables, since they are not delimited by quotes.


thank you that worked :smile: i thought that lists are automatically defined as strings.


Thanks for replying, yeah they're intended to be strings, and i thought they'll be considered automatically as strings till i read the replies and found the solution :slight_smile: