Python标准模块——math

来源:互联网 发布:f22到底有多先进知乎 编辑:程序博客网 时间:2024/06/10 10:18

9、 math

实数
floor(x):向下取整,但返回的不是整数,而是浮点数

ceil(x):向上取整,返回值为float

sqrt(x):求根值,返回值为float

>>>import math>>>math.floor(2.3)2.0

复数

>>>import cmath>>>cmath.sqrt(-1)1j
0 0
原创粉丝点击