传入参数中 第一个为空不可以看成None吗、、?
def average(*args):
sum = 0.0
n = 0
if args == None:
return sum
for x in args:
sum = x + sum
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
if args == None:
return sum
for x in args:
sum = x + sum
n = n + 1
return sum/n
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
我这样子不是吗? 没有传入参数不就是空嘛?
2018-07-25
举报