Why does math.log result in ValueError: math domain error?
Your code is doing a log of a number that is less than or equal to zero. That’s mathematically undefined, so Python’s log function raises an exception. Here’s an example: >>> from math import log >>> log(-1) Traceback (most recent call last): File “<pyshell#59>”, line 1, in <module> log(-1) ValueError: math domain error Without knowing … Read more