16. using strings in lists and functions


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

print join_strings(n)

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


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)


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


I will rework it then


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)


okay, figured it out