ValueError: negative number cannot be raised to a fractional power

前端 未结 2 1203
离开以前
离开以前 2020-11-29 11:16

When I tried this in terminal

>>> (-3.66/26.32)**0.2

I got the following error

Traceback (most recent call last):
         


        
2条回答
  •  遥遥无期
    2020-11-29 11:46

    Switch to Python 3 which automatically promotes the result to a complex number:

    >>> (-3.66/26.32)**0.2
    (0.5452512685753758+0.39614823506888347j)
    

提交回复
热议问题