请问这种情况下如何修正?
def average(*args):
n = len(args)
if n == 0:
return 0.0
else:
ave = sum(args)/n*1.0
return ave
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
def average(*args):
n = len(args)
if n == 0:
return 0.0
else:
ave = sum(args)/n*1.0
return ave
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2019-07-29
举报