Latest web development tutorials

Python3 log10 function ()

digitale python3 digitale python3


descrizione

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


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/python3
import math   # 导入 math 模块

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

Dopo aver eseguito l'output sopra esempio è:

math.log10(100.12) :  2.0005208409361854
math.log10(100.72) :  2.003115717099806
math.log10(119) :  2.075546961392531
math.log10(math.pi) :  0.4971498726941338

digitale python3 digitale python3