如何使得输出的结果为整数?而不是浮点数
L = [75, 92, 59, 68, 99] sum = 0.00 for x in L: sum = sum + x cy = sum/5 print(int(cy))
用int()去把cy从浮点型转为整数型
L = [75, 92, 59, 68, 99]
sum = 0
for cy in L:
sum = sum + cy
print(sum)