How to calculate the natural logarithm of a number to a given base in Python

1 Answer

0 votes
import math

print("math.log(10.13) : ", math.log(10.13, 3))
print("math.log(10.81) : ", math.log(10.81, 3))
print("math.log(math.pi) : ", math.log(math.pi, 2))


'''
run:

math.log(10.13) :  2.1076601291869435
math.log(10.81) :  2.166798657001238
math.log(math.pi) :  1.651496129472319

'''

 



answered Oct 18, 2017 by avibootz
...