anti_vowel# strange problem about usage of list--help


#1



https://www.codecademy.com/en/courses/python-intermediate-en-rCQKw/1/2?curriculum_id=4f89dab3d788890003000096

Traceback (most recent call last):
File "C:\Users\Pan\Documents\Python\anti_vowel.py", line 9, in
anti_vowel("Hey look Words!")
File "C:\Users\Pan\Documents\Python\anti_vowel.py", 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":
            result.append(i)
    return "".result

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


#2

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


#3

did you solved it by using join?


#4

yep,I made it! :slight_smile: