以list作为参数将tuple类初始化,将返回tuple类型
tuple([1,2,3]) #list转换为tuple
- 1
- 2
以tuple作为参数将list类初始化,将返回list类型
list((1,2,3)) #tuple转换为list
- 1
- 2
向上取整
print("math.ceil(4.4) => ", math.ceil(4.4))
print("math.ceil(4.7) => ", math.ceil(4.7))
- 1
- 2
- 3
向下取整
print("math.floor(4.4) => ", math.floor(4.4))
print("math.floor(4.7) => ", math.floor(4.7))
- 1
- 2
- 3
四舍五入
print("round(4.4) => ", round(4.4))
print("round(4.7) => ", round(4.7))