Python中可以用如下方式表示正負無窮: float("inf"), float("-inf") 利用inf 做簡單加、乘算術運算仍會得到inf >>> 1 + float('inf') inf >>> 2 ...
確定! 回上一頁