16. Using Strings in Lists in Functions


#1


Not quite sure what I'm doing wrong. Help?


https://www.codecademy.com/courses/python-beginner-nzzVa/3/5?curriculum_id=4f89dab3d788890003000096


join_strings(['x', 'y', 'z', 'a']) resulted in an error: maximum recursion depth exceeded


Should return as MichaelLieberman


n = ["Michael", "Lieberman"]
def join_strings(words):
    result=''
    for word in words:
        result = result + word
    print join_strings(n)


#2

Remove the indentation on that line so it is outside of the function.

Inside the function, return result.


#3

it just returns michael, not michaellieberman. How should I adjust it to make it print all items?


#4

Be sure the return statement is not inside the loop. Let the loop finish, then return result.


#5

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