I have the following code. I need to calculate log10(x) without math function. How can i do this?
class Solution(object):
def findPower(self, number, exponent):
resultPower = 1
for i in range(1, int(exponent) + 1):
resultPower = resultPower * number
return resultPower
def log10(self,x):
...
def mySqrt(self, x):
return self.findPower(10, (self.log10(x)) / 2)
I've found the formulas.
But how i should use it ?