亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

簡(jiǎn)單介紹Python中的floor()方法

 更新時(shí)間:2015年05月15日 09:11:11   投稿:goldensun  
這篇文章主要介紹了Python中的floor()方法,是Python入門的基礎(chǔ)知識(shí),需要的朋友可以參考下

 floor()方法返回不大于x的最大整數(shù)(向下取整)。
語(yǔ)法

以下是floor()方法的語(yǔ)法:

import math

math.floor( x )

注意:此函數(shù)是無(wú)法直接訪問(wèn)的,所以我們需要導(dǎo)入math模塊,然后需要用math的靜態(tài)對(duì)象來(lái)調(diào)用這個(gè)函數(shù)。
參數(shù)

  •     x -- 這是一個(gè)數(shù)值表達(dá)式。

返回值

此方法返回不大于x的最大整數(shù)。
例子

下面的例子顯示了floor()方法的使用。

#!/usr/bin/python
import math  # This will import math module

print "math.floor(-45.17) : ", math.floor(-45.17)
print "math.floor(100.12) : ", math.floor(100.12)
print "math.floor(100.72) : ", math.floor(100.72)
print "math.floor(119L) : ", math.floor(119L)
print "math.floor(math.pi) : ", math.floor(math.pi)

當(dāng)我們運(yùn)行上面的程序,它會(huì)產(chǎn)生以下結(jié)果:

math.floor(-45.17) : -46.0
math.floor(100.12) : 100.0
math.floor(100.72) : 100.0
math.floor(119L) : 119.0
math.floor(math.pi) : 3.0

相關(guān)文章

最新評(píng)論