16. Using strings in lists in functions


#1


where do I get it wrong?


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


print join_strings(n)


#2

.append() is a method to append items to a list, .append() can't add to strings.


#3

so if I was asked to add numbers together instead of words, my formula would have worked right?


#4

No, .append() can adds items (strings, booleans, integers) to a list.


#5

Hi! You see, append is like prolong, but has nothing to do with math addition.
It is prolongs the list, but does not perform any operations with its items, rather adds another item to the end of the list or to a certain position.


#7

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