How to fix ValueError: math domain error in Python | DevErrors