-4
如何减少2个做同样事情的功能? 事实上,将阵列score
与阵列score2
相加是一个问题。减少我的功能
def printPoint1(name, point, score):
for i in range(len(name)):
print("Name : " + name[i] + " Your score is of " + str(point[i]) + " : " + str(goal[i]) + " goals. ")
score.append(point[i])
def printPoint2(name, point, score2):
for i in range(len(name)):
print("Name : " + name[i] + " Your score is of " + str(point[i]) + " : " + str(goal[i]) + " goals. ")
score2.append(point[i])
对不起,但我不明白你在问什么。什么是目前不能在你的代码中工作?请编辑您的问题,使其更清楚目前失败的内容。 – idjaw
你不需要第二个。你通过score变量传递一个类似列表的对象。这可以是任何列表。这两个功能完全相同。只需删除第二个,并使用第一个与您想使用它的任何类似列表的对象。 –