Latest web development tutorials

función log10 Python ()

cifras Python cifras Python


descripción

log10 () devuelve el logaritmo en base 10 de x.


gramática

El siguiente es el método log10 sintaxis ():

import math

math.log10( x )

Nota: log10 () no son directamente accesibles, tenemos que importar módulo matemático, invoque el método a través del objeto estático.


parámetros

  • x - expresión numérica.

Valor de retorno

Las devoluciones logaritmo en base 10 de x, x> 0.

Ejemplos

A continuación se muestra un ejemplo del uso método 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)

Después de ejecutar la salida anterior ejemplo es:

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

cifras Python cifras Python