본문 바로가기

코딩테스트 준비/백준

파이썬 : 반올림, 올림, 내림 - 포도코

반올림 (내장된 round함수)

>>> round(3.1415) #결과는 3

 

올림

>>>import math

>>>math.ceil(-3.14) #결과는 -3

>>>math.ceil(3.14) #결과는 4

 

내림

>>> import math

>>> math.floor(3.14) #결과는 3

>>> math.floor(-3.14) #결과는 -4