这个为什么不对呢?
def average(*args):
sum=0.0
n=0
for i in args:
sum = sum + i
n = n + 1
return sum/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
def average(*args):
sum=0.0
n=0
for i in args:
sum = sum + i
n = n + 1
return sum/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2019-03-13
举报