内置函数_round

描述:

round()函数: 四舍五入,保留到指定的小数位

 

语法:

   round(小数,保留的位数)

 

示例代码:

num = 3.1459267

print(round(num, 1))  # 3.1
print(round(num, 2))  # 3.15
View Code

 

posted @ 2021-04-02 18:09  御姐玫瑰  阅读(157)  评论(0编辑  收藏  举报
levels of contents