I want to add with a function log100()
to the math module:
def log100(number):
ans = math.log(number,100)
return ans
I can't see how I can do it without using "os" module to add directories.
I want to add with a function log100()
to the math module:
def log100(number):
ans = math.log(number,100)
return ans
I can't see how I can do it without using "os" module to add directories.
Although it isn't the best idea -- you risk confusing people who read your code later by messing with standard modules -- you could do something like
math.log100 = lambda x: math.log(x, 100)
or
def log100(x):
return math.log(x, 100)
math.log100 = log100
, which then can be called as
math.log100(10) # Output 0.5