Latest web development tutorials

piano Python function ()

figure Python figure Python


descrizione

piano () Restituisce il numero intero arrotondato.


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 il numero intero arrotondato per difetto.

Esempi

Quanto segue mostra un esempio di utilizzo il metodo piano ():

#!/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)

Dopo aver eseguito l'output sopra esempio è:

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

figure Python figure Python