1.round
四捨五入(真實是“四捨六入五成雙”)
round(3.4)
==>3
round(3.5)
==>4
# 指定小數位數取值
round(3.5554, 3)
==>3.555
round(3.5555, 3)
==>3.556
# 取第幾位,如果取得那位後面是5,取得那位是奇數,則舍, 取得那位是偶數,則入
print(round(3.46575, 4))
==>3.4657
print(round(3.465465, 5))
==>3.46547
2.math
a. 取大
import math
math.meil(3.4)
==>4
math.meil(3.6)
==>4
b.取小
import math
math.floor(3.4)
==>3
math.floor(3.6)
==>3