四捨五入
import math
math.round(4.5)
結果 4
math.round(4.6)
結果 5
pythonの四捨五入は五捨六入なので要注意
桁の指定は
math.round(4.563,2)
結果 4.56
切りあげ
math.ceil(2.2)
結果 3
import math
math.round(4.5)
結果 4
math.round(4.6)
結果 5
pythonの四捨五入は五捨六入なので要注意
桁の指定は
math.round(4.563,2)
結果 4.56
math.ceil(2.2)
結果 3