# round(x[,n])
# x 数学表达式,n表示小数点位数,默认值是0
# round 四舍五入,准确来说,若两边一样距离,则会保留到偶数的一遍
print(round(1.5)) # 2
print(round(-0.5)) # 0
print(round(0.5)) # 0
# https://blog.csdn.net/weixin_39593593/article/details/111427272
print(round(70.2345,3)) # 70.234
print(round(2.675,2)) # 2.67 与浮点数的精度有关
# https://m.runoob.com/python3/python3-func-number-round.html







网友评论