求大神解答
def average(*args): sum=0.0 if len(args)==0: return sum for i in args: sum=sum+i print sum/len(args)print average()print average(1, 2)print average(1, 2, 2, 3, 4)
为什么我的代码运行了会比答案多两个None
def average(*args): sum=0.0 if len(args)==0: return sum for i in args: sum=sum+i print sum/len(args)print average()print average(1, 2)print average(1, 2, 2, 3, 4)
为什么我的代码运行了会比答案多两个None
2018-11-18
举报