0
Q:

logarithm in python

Syntax :
math.log(a,Base)

Parameters : 
a : The numeric value
Base :  Base to which the logarithm has to be computed.
Return Value : 
Returns natural log if 1 argument is passed and log with
specified base if 2 arguments are passed.
Exceptions : 
Raises ValueError is a negative no. is passed as argument.
5
# Python code to demonstrate the working of 
# log2(a) 
  
import math 
  
# Printing the log base 2 of 14 
print ("Logarithm base 2 of 14 is : ", end="") 
print (math.log2(14)) 
2

New to Communities?

Join the community