请问这样怎么不对?
def average(*args):
x=0.0
n=0
for s in args:
s=s+x
n=n+1
if n==0:
return 0
else:
return s/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
def average(*args):
x=0.0
n=0
for s in args:
s=s+x
n=n+1
if n==0:
return 0
else:
return s/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2018-01-13
举报