math 모듈의 floor 메서드
math 모듈의 floor 메서드는
숫자를 항상 내림하여 정수로 만듭니다.
구문
pythonimport math
math.floor(숫자)
예제
25.78을 내림해 봅시다:
pythonimport math
print(math.floor(25.78))
코드 실행 결과:
python25
예제
이제 floor 메서드를
-4.88에 적용해 보겠습니다:
pythonimport math
print(math.floor(-4.88))
코드 실행 결과:
python-5