我按照参考答案的程序敲上去,但是过不去,用NP++写然后用cmd运行,说for x in args:这行有问题,大家帮我看看什么问题
def average(*args):
sum =0.0
if len(args)==0:
return sum
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
for x in args:
sum = sum + x
return sum/len(args)
print average()
print average(1,2)
print average(1,2,2,3,4)
2014-12-29
举报