日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python中如何使用round函數(shù)

在python3中,ROUND(1.0/2.0)得到的是1,而在python2中,round(1.0/2.0)得到的是0

$ python
Python 2.7.8 (default, Jun 18 2015, 18:54:19) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> round(0.5)
1.0
$ python3
Python 3.4.3 (default, Oct 14 2015, 20:28:29) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> round(0.5)
0

使用的一般語法是round(number,digits)

number,要四舍五入的數(shù),digits是要小數(shù)點(diǎn)后保留的位數(shù)

如果 digits 大于 0,則四舍五入到指定的小數(shù)位。 
如果 digits 等于 0,則四舍五入到最接近的整數(shù)。 
如果 digits 小于 0,則在小數(shù)點(diǎn)左側(cè)進(jìn)行四舍五入。
如果round函數(shù)只有參數(shù)number,等同于digits 等于 0。

返回的值是四舍五入后的值。python學(xué)習(xí)網(wǎng),大量的免費(fèi)python學(xué)習(xí)視頻,歡迎在線學(xué)習(xí)!


分享題目:創(chuàng)新互聯(lián)Python教程:python中如何使用round函數(shù)
轉(zhuǎn)載來于:http://www.5511xx.com/article/cocddhj.html