Latest web development tutorials

Python log10 function ()

figure Python figure Python


descrizione

log10 () restituisce il logaritmo in base 10 di x.


grammatica

Quanto segue è il metodo sintassi log10 ():

import math

math.log10( x )

Nota: log10 () non sono direttamente accessibili, abbiamo bisogno di importare il modulo per la matematica, richiamare il metodo attraverso oggetto statico.


parametri

  • x - espressione numerica.

Valore di ritorno

I ritorni logaritmo in base 10 di x, x> 0.

Esempi

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

#!/usr/bin/python
import math   # 导入 math 模块

print "math.log10(100.12) : ", math.log10(100.12)
print "math.log10(100.72) : ", math.log10(100.72)
print "math.log10(119L) : ", math.log10(119L)
print "math.log10(math.pi) : ", math.log10(math.pi)

Dopo aver eseguito l'output sopra esempio è:

math.log10(100.12) :  2.00052084094
math.log10(100.72) :  2.0031157171
math.log10(119L) :  2.07554696139
math.log10(math.pi) :  0.497149872694

figure Python figure Python