return的位置不同导致不同的结果(来自夜曲编程)
def getword(words):
word = ""
for i in words:
word = word + i
return word
print(getword(["ye","qu"]))
#如果return在循环内部,循环只进行一次
def getword(words):
word = ""
for i in words:
word = word + i
return word
print(getword(["ye","qu"]))
版权声明:本文为m0_63098987原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。