16. using strings in lists and functions


#1

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


print join_strings(n)

File "python", line 7
SyntaxError: 'return' outside function


#2

why is your for loop outside of your function? you use append() wrong (syntax wise) and its not the right function to use given its for adding items to a list (not string)


#3

but the issue it shows is in line 7, would it be able to pass if I just correct line 7


#4

I will rework it then


#5

no, the interpreter tells you the first syntax problem is at line 7.

before you have valid syntax, but still problems (loop is outside the function, doesn't fit in the design of your program, but the interpreter doesn't know that)


#6

okay, figured it out


#7