1、向下取整

a=1.3
b=1.7
a = int(a)
b = int(b)
print(a,b)

2、向上取整

import math
a = 1.3
b = 1.7
a = math.ceil(a)
b = math.ceil(b)
print(a,b)

3、四舍五入

a = 1.3
b = 1.7
a =round(a)
b =round(b)
print(a,b)

4、向下取整

import math
a = 1.3
b = 1.7
a =math.floor(a)
b =math.floor(b)
print(a,b)


相关文章:

  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2021-11-04
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案