Using strings in lists in functions


#1

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)

This is the code that i wrote, its giving me error that the code is bit off. Please help me!


#2

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

take a look at your loop. You need to use range. the code above should work


#3

Thanks a lot buddy, it finally worked!:grinning:


#4

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