Using strings in lists in functions


This is my code:

“”"n = [“Michael”, “Lieberman”]

Add your function here

def join_strings(words):
result = ""
for i in words:
result = result + words[i]
return result

print join_strings(n)"""

It keeps on loading, what did I do wrong? please help!


using a for in loop without range will give you the values of the list directly, so you can add i directly to the string

using range() gives you indexes, then you need the square brackets to get values from list using indexes


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