Ad
  • Custom User Avatar

    Please document the error you see properly before raising an issue. You're not helping anybody with that.

    Anyways, ValueError: math domain error should be very indicative of what's the problem. So it's your code's issue.

  • Custom User Avatar

    I have the same error with Python's math module. Tried on Python 2 and Python3, error remains.

  • Custom User Avatar

    Can you screenshot the error? I'm interested why you are getting an error.

    It might because you are using math.sqrt(n) but n can be negative. √-1 = i. i is a complex number. You cannot square root a negative number - otherwise it ends up being a complex number (imaginary). You must check if n >= 0

  • Custom User Avatar

    I had the same issue. Not sure why some encounter it while others don't

  • Custom User Avatar

    Nothing wrong with that. But lambda usually makes the readability worse; and list comprehension is usually preferred over map (which is not so "pythonic").

  • Custom User Avatar

    Did you use Python2 or Python3? There were some problems reported with Python3, IIRC.