-
[Python] 무한대 표현Python/기타 2022. 10. 10. 20:17
float
무한대는 float형이다. int형으로 형변환 할 수 없다.
>>> positive_infinity = float("inf") inf >>> negative_infinity = float("-inf") -inf
Math
Python 3.5 이상부터 사용가능하다.
>>> import math >>> positive_infinity = math.inf inf >>> negative_infinity = -math.inf -inf
'Python > 기타' 카테고리의 다른 글
[Python] 바다 코끼리 연산자(the walrus operator) (2) 2022.10.11