파이썬 math.fmod() 메서드
예시
x/y의 나머지를 반환합니다.
# Import math Library
import math
# Return the remainder of x/y
print(math.fmod(20,
4))
print(math.fmod(20, 3))
print(math.fmod(15, 6))
print(math.fmod(-10, 3))
print(math.fmod(0, 0))
정의 및 사용
이 math.fmod()
메서드는 x/y의 나머지(모듈로)를 반환합니다.
통사론
math.fmod(x, y)
매개변수 값
Parameter | Description |
---|---|
x | Required. A positive or negative number to divide |
y | Required. A positive or negative number to divide x with |
참고: x와 y가 모두 0이면 ValueError를 반환합니다.
참고: y = 0이면 ValueError를 반환합니다.
참고: x 또는 y가 숫자가 아니면 TypeError를 반환합니다.
기술적 세부 사항
반환 값: | float x/y의 나머지를 나타내는 값 |
---|---|
파이썬 버전: | 1.4 |