Latest web development tutorials

función de registro de Python ()

cifras Python cifras Python


descripción

log () devuelve el logaritmo natural de x.


gramática

El siguiente es el método de registro de la sintaxis ():

import math

math.log( x )

Nota: log () no es directamente accesible, 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

Devuelve el logaritmo natural de x, x> 0.

Ejemplos

A continuación se muestra un ejemplo del uso del método de registro ():

#!/usr/bin/python
import math   # This will import math module

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

Después de ejecutar la salida anterior ejemplo es:

math.log(100.12) :  4.60636946656
math.log(100.72) :  4.61234438974
math.log(119L) :  4.77912349311
math.log(math.pi) :  1.14472988585

cifras Python cifras Python