Copyright © tutorialspoint.com

Python Number log() Function

previous next


Description:

This function returns natural logarithm of x, for x > 0.

Syntax:

import math

math.log( x )

Note: This function is not accessible directly so we need to import math module and then we need to call this function using math static object.

Parameters:

Here is the detail of parameters:

Return Value:

The natural logarithm of x, for x > 0

Example:

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

This will produce following result:

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

previous next

Copyright © tutorialspoint.com