print(average(1,2,2,3,4)),为什么求出来是2,而不是2.4
def average(*args):
sum = 0
if len(args) == 0:
return sum
for item in args:
sum += item
avg = sum / len(args)
return avg
print(average(1,2,2,3,4))
为什么这个求出来是2,而不是2.4
def average(*args):
sum = 0
if len(args) == 0:
return sum
for item in args:
sum += item
avg = sum / len(args)
return avg
print(average(1,2,2,3,4))
为什么这个求出来是2,而不是2.4
2021-04-01
举报