Oops, try again. join_strings(['x', 'y', 'z', 'a']) returned 'xy' instead of 'xyza'


#1


Oops, try again.
join_strings(['x', 'y', 'z', 'a']) returned 'xy' instead of 'xyza'


I don't understand what's wrong with the code?


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


print join_strings(n)


#2

len(n) you should get len of words. this is standard.
the codecademy validator check your code with self inputs, and inputs is
['x', 'y', 'z', 'a']

but you check in your code len of n that always is 2. you should get len of words


#3

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