Python, trunc(), int(), ceil(), floor()

# trunc() - for 0
import math
print(math.trunc(1.234))    #1
print(math.trunc(-1.234))   #-1

# int() - for 0
print(int(1.234))     #1
print(int(-1.234))    #-1

# floor() - for minus
import math
print(math.floor(1.234))    #1
print(math.floor(-1.234))   #-2

# ceil() - for plus
import math
print(math.ceil(1.234))     #2
print(math.ceil(-1.234))    #-1



댓글

이 블로그의 인기 게시물

<배당주 투자> 배당주(은행) '22년 8월

은행주 - 배당주 투자 일기, 2022.07.04(월)

<배당주 투자> 지주사, '22년 8월