共計 257 個字符,預計需要花費 1 分鐘才能閱讀完成。
在 Python 中,floor()
函數是 math 模塊中的一個函數,用于返回一個數字的下舍整數,即比這個數字小且最接近這個數字的整數。
要使用 floor()
函數,首先需要導入 math 模塊:
import math
然后就可以使用 math.floor()
函數來對一個數字進行下舍整數操作,例如:
import math
num = 3.78
result = math.floor(num)
print(result) # 輸出 3
在上面的例子中,math.floor()
函數對 3.78 進行下舍整數操作,返回結果為 3。
丸趣 TV 網 – 提供最優質的資源集合!
正文完