python之设置小数保留位数
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)
运行截图:
python之设置小数保留位数
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)
运行截图: