Home >>Python math Module >Python math.log2() Method
Python math.log2() method is used to return the base-2 logarithm of the given input number.
Syntax:math.log2(x)
Parameter | Description |
---|---|
x | Required. Specifies the value to calculate the logarithm for. |
import math
print(math.log2(10))
print(math.log2(2))
print(math.log2(1))