Using strings in lists in functions. Please Help


#1

I am stuck on this code. Please help.

Here is the error message
Oops, try again. join_strings(['a', 'o', 'e', 'u', 'i']) returned 'xyza' instead of 'aoeui'

Here is my code

n = ["Michael", "Lieberman"]
def join_strings(words):
    result = ""
    for i in words:
        words.append(result)
        return result



print join_strings(n)

#2

i see several problems, lets start with this line:

words.append(result)

so you are going to append result to words? Not so sure about that. Then another problem, i guess you want to append words to result, right? But result is a string, and append is used for list, to join something to a string use + instead. But what exactly is it you want to add to result? i, since that is what looping over the words, so you can add them to the string one by one:

result = result + i

also, your loop currently runs once, i would put return at the same indent level as the for loop. This way, the for loop can run until finished, then a return keyword is reached, and the function ends


#3

Thank you for the help.