n = ["Michael", "Lieberman"] # Add your function here def join_strings(words): result = "" for i in range(len(words)): words.append(result) return result print join_strings(n) """"Hey Guys I've already completed the course I just wanted to figure out why the .append() method doesn't seem to work. Please Help."""
your result is empty string and you are appending empty string. Maybe you want to append i?
Thanks! Have just tried your method. But now its giving me this error:
Oops, try again. join_strings(['x', 'y', 'z', 'a']) returned '' instead of 'xyza'.
Tried it on IDLE too
append to result and not to words:
You need to append your i to result to get string
Oops, try again. join_strings(['x', 'y', 'z', 'a']) resulted in an error: 'str' object has no attribute 'append'
And also trying to run this other code on IDLE please tell me what I'm dooing wrong. I want to create a single list out of the sub lists.
n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]
results = 
for lists in n:
for numbers in lists:
result += lists[numbers]
your variable is called result not results
Haha yea that was a typo. I wrote result but still gave same error.
Oh, your return should be outside of the loop and you can't append string, it just works for list. You can try something like this
result += words[i]