test.py:
a = [3,4,4,4,6,4] average1 = float(sum(a)/len(a)) average2 =round(average1,2) print(average1) print(‘round()处理,保留两位小数后:‘) print(average2)
运行截图:
时间: 2024-10-12 21:20:27
test.py:
a = [3,4,4,4,6,4] average1 = float(sum(a)/len(a)) average2 =round(average1,2) print(average1) print(‘round()处理,保留两位小数后:‘) print(average2)
运行截图: