I dont know why this does not work ??

def anti_vowel(text):
    lst = []
    for v in lst:                
        if v in "aieouAEIOU":
           # v.remove(text)
    return "".join(lst)
    print anti_vowel("Hey look Words")


if you place the function call outside the function, you can actually see what your function is doing.

well lets start here:

for v in lst:

looping over an empty list means there is nothing to iterate, the loop will never run


This is what I did now, still error

def anti_vowel(text):
    lst = []
    for x in text:                
        if x in "aieouAEIOU":
    return "".join(text)
    print anti_vowel("Hey look Words")


if you followed this suggestion you would have seen the following error message:

File "python", line 7, in anti_vowel
AttributeError: 'str' object has no attribute 'remove'

lets look at line 7:


what is text? text is a string (object), strings are immutable in python, you can't use remove() method on strings.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.