Linked Questions

Popular Questions

How to code logarithm in python(without any libraries)

Asked by At

Yes, I know that you can do:

import math

print(math.log(2, 10))

But I want to do it without using any libraries. Is it even possible?

I could try using:

def log(a, base):
  for x in range(0, base):
    if base ** x == round(a, 5):
      return x

but that would be slow.

Related Questions