# [ACCEPTED]-python logarithm-python

Score: 10

You can only compute the logarithm of a 8 positive number. Trying to compute the logarithm 7 for a negative number or zero will result 6 in a "math domain error" in Python.

By the 5 way: it looks like you're actually trying 4 to compute a logarithm base 2. You can do 3 this with `math.log`:

``````w=math.log(q*q1, 2)
``````

The second, optional, parameter 2 is the base. It defaults to e (ie: natural 1 log).

Score: 9

Is q or q1 equal to zero or one of them 1 negative?

Score: 1

math.log10(0) is minus infinity. See: http://en.wikipedia.org/wiki/Logarithm

0

Score: 1

try to make sure the value whose log you 4 are trying to find can never be 0. As log(0) tends 3 to negative infinity, the function call 2 will give you a math domain error. Correct 1 that and I think you'll be fine.

More Related questions