Python math.log() Method

Math Methods : Find the natural logarithm of different numbers"

Definition and Usage

The math.log() method returns the natural logarithm of a number, or the logarithm of number to base.

Syntax

math.log(x, base)

Parameter Values

Parameter Description
x Required. Specifies the value to calculate the logarithm for. If the value is 0 or a negative number, it returns a ValueError. If the value is not a number, it returns a TypeError
base Optional. The logarithmic base to use. Default is 'e'

Technical Details

Return Value: A float value, representing the natural logarithm of a number, or the logarithm of number to base
Python Version: Changed in version 2.3
Change Log: The base parameter was added