这样写哪里出错了?没搞明白,求解答
def average(*args):
sum =0.0
if len(args)=0:
return sum
else:
for x in args:
sum = sum + x
return sum /len(args)
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
def average(*args):
sum =0.0
if len(args)=0:
return sum
else:
for x in args:
sum = sum + x
return sum /len(args)
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2017-02-11
举报