Whats the problem in this code!


#1

n = ["Michael", "Lieberman"]

Add your function here

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

print join_strings(n)

it gives the error message:Oops, try again. join_strings(['x', 'y', 'z', 'a']) resulted in an error: local variable 'result' referenced before assignment

thankyou for the help


#2

here:

result == ""

two equal sign means check if equal, why would you do this here?

here:

result = result + result.append(i)

append() a method for appending to lists. use + to concat strings


#3

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