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


#1



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


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)


#2

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)


#3

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