개발/Python

파이썬 자리수 조절

Louisus 2020. 5. 7. 00:24
728x90

1. 반올림

소수점 n번째 까지만 표현하고 반올림

round(실수, n)

 

2. 올림

math.ceil(n)

 

3. 내림

math.floor(n)

 

4. 버림

math.trunc(n)