为什么0 和0.0 的答案不一样
L = [75, 92, 59, 68, 99]
b = 0
for a in L:
b = a + b
print(b/len(L))
#答案是78
L=[75,92,59,68,99]
sum=0.0
for x in L:
sum=sum+x
print(sum/5)
#答案是78.6
L = [75, 92, 59, 68, 99]
b = 0
for a in L:
b = a + b
print(b/len(L))
#答案是78
L=[75,92,59,68,99]
sum=0.0
for x in L:
sum=sum+x
print(sum/5)
#答案是78.6
2021-08-20
举报