为什么每个结果都多一个“NONE”
def average(*args):
if args == ():
print 0.0
else:
i = 0.0
sum = 0.0
for n in args:
sum = sum + n
i = i + 1
print sum/i
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
def average(*args):
if args == ():
print 0.0
else:
i = 0.0
sum = 0.0
for n in args:
sum = sum + n
i = i + 1
print sum/i
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2019-01-11
举报