Python Lists and Functions


#1

This is my code,

n = ["Michael", "Lieberman"]

Add your function here

def join_strings(words):
result = ""
for x in words:
result.append(x)
return result

print join_strings(n)

The error it returns is,

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

I'm guessing I'm trying to append incorrectly, how would I do that?


#2

your result is empty string, if you want to append you need empty list
result = [ ]


#3

Thanks! :evergreen_tree: