Using strings in lists and functions


#1

Hello. I'm supposed to make a function that concatanates the strings inside a list and returns the result. I keep getting this erro msg:

Traceback (most recent call last):
File "python", line 9, in
File "python", line 4, in join_strings
UnboundLocalError: local variable 'result' referenced before assignment

I have no idea what I did wrong. Please help.

n = ["Michael", "Lieberman"]

def join_strings(words):
    result == ""
    for wrd in words:
        result += wrd
    return result

print join_strings(n)

#2

here:

result == ""

two equal signs means check if equal, why would you do that here?


#3

Wow, what a fast reply. Thank you, very much appreciated. I dont know what got to me there:sweat_smile:


#4