16/18: returned "xyza" instead of "xyza"



I attempted this question with the following code and the results seemed corrected. However, I was given an error message:
Oops, try again. join_strings(['x', 'y', 'z', 'a']) returned ' xyza' instead of 'xyza'

I expected the code to work but apparently "xyza" =/= "xyza"...

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

print join_strings(n)


Those two strings really are different, they're not the same length. (Compare character-by-character in the future! Preferably with an automated tool, though these are short enough to do manually, it's just that you can't stop as soon as your mind recognizes both as similar)


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