piano python3 function ()
descrizione
piano (x) restituisce l'intero arrotondato inferiore o uguale a x.
grammatica
Quanto segue è il metodo piano sintassi ():
import math math.floor( x )
NOTA: piano () non è direttamente accessibile, abbiamo bisogno di importare il modulo per la matematica, richiamare il metodo attraverso oggetto statico.
parametri
- x - espressione numerica.
Valore di ritorno
Restituisce un intero minore o uguale a x.Esempi
Quanto segue mostra un esempio di utilizzo il metodo piano ():
#!/usr/bin/python import math # 导入 math 模块 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(math.pi) : ", math.floor(math.pi))
Dopo aver eseguito l'output sopra esempio è:
math.floor(-45.17) : -46 math.floor(100.12) : 100 math.floor(100.72) : 100 math.floor(math.pi) : 3