How can i use (x.append()) in this code?


#1



https://www.codecademy.com/courses/python-beginner-nzzVa/3/5?curriculum_id=4f89dab3d788890003000096#

Traceback (most recent call last):
File "python", line 7, in
File "python", line 5, in join_strings
AttributeError: 'str' object has no attribute 'append'


Replace this line with your code. 

n = ["Michael", "Lieberman"]
def join_strings(words):
    result = ""
    for i in range(len(words)) :
        result.append('words[i]')
    return result# Add your function here
print join_strings(n)


#2

If x is a string then you can't, strings don't have such a method, just like the error message says. Strings can't be changed, you can only make new ones.


#3

thank you man :grinning:


#4

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