[Python] python四舍五入函数round的用法范例 →→→→→进入此内容的聊天室

来自 , 2020-11-18, 写在 Python, 查看 114 次.
URL http://www.code666.cn/view/fea16e78
  1. print round(3.4)         # 3  
  2. print round(3.5)         # 4  
  3. print round(3.6)         # 4  
  4. print round(3.6, 0)      # 4  
  5. print round(1.95583, 2)  # 1.96  
  6. print round(1241757, -3) # 1242000  
  7. print round(5.045, 2)    # 5.05  
  8. print round(5.055, 2)    # 5.06
  9. #//python/4618

回复 "python四舍五入函数round的用法范例"

这儿你可以回复上面这条便签

captcha