Using strings in lists in functions


#1

Need help~~~

What's wrong with my code?

Error message at console window:
Oops, try again. join_strings(['x', 'y', 'z', 'a']) returned [['x', 'y', 'z', 'a'], ['x', 'y', 'z', 'a'], ['x', 'y', 'z', 'a'], ['x', 'y', 'z', 'a']] instead of 'xyza'

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


#2

.append() is a method for appending to lists, you need to concate a string, use +


#3

3 posts were split to a new topic: Using strings in lists in functions


#7