69 字
约 13 秒
9
浮点数的计算
2026-09-26
无标签
浮点数的计算
n1 = 2.1
n2 = 15.256
print(n1 + n2)
四舍五入
n3 = round(n1 + n2, 2)
print(n3)
import math
向上取整 ceil
n4 = math.ceil(n1 + n2)
print("向上取整的结果是", n4)
向下取整 floor
n5 = math.floor("向下取整的结果是", n5)
评论
0 条
还没有评论,先写一条吧。