파이썬 math.isqrt() 메서드
예시
제곱근을 가장 가까운 정수로 반올림합니다.
# Import math Library
import math
# Print the square
root of different numbers
print (math.sqrt(10))
print (math.sqrt (12))
print (math.sqrt (68))
print (math.sqrt (100))
# Round square root
downward to the nearest integer
print (math.isqrt(10))
print
(math.isqrt (12))
print (math.isqrt (68))
print (math.isqrt (100))
정의 및 사용
이 math.isqrt()
방법은 제곱근을 가장 가까운 정수로 반올림합니다.
참고: 숫자는 0보다 크거나 같아야 합니다.
통사론
math.isqrt(x)
매개변수 값
Parameter | Description |
---|---|
x | Required. The number to round the square root of. If x is negative, it returns a ValueError. If x is not a number, it returns a TypeError |
기술적 세부 사항
반환 값: | int 소수 없이 숫자의 제곱근을 나타내는 값 |
---|---|
파이썬 버전: | 3.8 |