Using strings in lists in functions


#1

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)


#2

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


#3

should i use this code below?

for i in range(words):

???


#4

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


#5

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