Using String in list in function


#1

So now guys explain me this
I have the code below that works good

n = ["Michael", "Lieberman"]

Add your function here

def join_strings(words):
result = ""
for i in words:
result = result + i
return result
print join_strings(n)

and the code below that does not work even though the result on the screen is the same

n = ["Michael", "Lieberman"]

Add your function here

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

both codes results are

MichaelLieberman
None

but the first let me pass the exercise the second does not


#2

they want you to print the things inside the list, not the list itself.


#3

it did not print the list itself, both codes print the inside of the list and exactly same output

see below

MichaelLieberman
None


#4

Both outputs are not identical, for the second you have two results "MichaelLieberman" and "None"
For the second one does not make sense to use for loop. You may delete it. Because your list contain two object for loop will iterate twice. So you will get two outputs.