Using strings in lists in functions


something wrong with my code
what happened???

n = [“Michael”, “Lieberman”]

Add your function here

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

print join_strings(n)


i contains values from the words list, so you can add i directly to result. If you want to use indexes, you have to use range() in your for loop


should i use this code below?

for i in range(words):



its one of the two possible scenarios, so yes, you could use it


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