anti_vowel# strange problem about usage of list--help


Traceback (most recent call last):
File "C:\Users\Pan\Documents\Python\", line 9, in
anti_vowel("Hey look Words!")
File "C:\Users\Pan\Documents\Python\", line 7, in anti_vowel
return "".result
AttributeError: 'str' object has no attribute 'result'
[Finished in 0.1s with exit code 1]

I use 'result = []' to creat a list, but the message shows that I created a str,I wonder that's why?

def anti_vowel(text):
    l = list(text)
    result = []
    for i in l:
        if i not in "aeiouAEIOU":
    return "".result

anti_vowel("Hey look Words!")
#below this line is for test
a = []
print type(a)
print a


sorry for that,the '.'option is for 'str',list has no attribute of '.',transform list to str,you need to use ''.join(list)


did you solved it by using join?


yep,I made it! :slight_smile: