math1 Python 소수점 다루기 - math, int(), //1 소수점 내리는 방법 int() //1 math.floor() math.tunc() 양수에서는 위 방법 모두 같은 숫자 값을 보여준다. print(int(7.12)): 7 print(math.floor(7.12)): 7 print(7.12//1): 7.0 print(int(3.1415)): 3 print(math.floor(3.1415)): 3 print(3.1415//1): 3.0 //1은 float 음수에서는 다른 결과를 보여준다. print(int(-7.12)): -7 print(math.floor(-7.12)): -8 print(-7.12//1): -8.0 print(int(-3.1415)): -3 print(math.floor(-3.1415)): -4 print(-3.1415//1): -4.0 -.. 2023. 8. 16. 이전 1 다음