Python using strings in lists in Function

1.定义 join_strings,变量words
2.在function 里,创建一个参数result,and set it to "",an empty string
3.遍历 the words list and append each word to result
4.最后,return the result

n = ["Michael","Lieberman"]
def join_strings(words):
result = ""
for word in words:
result += word
return result
print join_strings(n)

你可能感兴趣的:(Python using strings in lists in Function)