真正的除法
>>> from __future__ import division
>>> 1 / 2
0.5
>>> 1.0 / 2.0
0.5
地板除
>>> 1 // 2# 地板除,返回整数...0
>>> 1.0 // 2.0# 地板除,返回浮点数
0.0
>>> -1 // 2# 返回比 -0.5小的整数,也就是 -1
-1
取余
>>> 4%3
1
>>> 4%2
0
幂运算
>>> 3...)
>>> divmod(2.5,10)
(0.0, 2.5)
>>> divmod(2+1j,0.5-1j)
((-0+0j), (2+1j))
pow()和 ** 都可以进行指数运算
>>> pow...,第二个参数表示精确到小数点多少位,没有表示精确到整数位
>>> round(3)
3.0
>>> round(3.45)
3.0
>>> round(3.499999999999)
3.0
>>> round...(复数取实数部分的商)
pow(num1,num2,mod=1)取num1的num2次方,如果提供mod参数,则计算结果再对mod进行取余运算
round(flt,ndig=0)接受一个浮点数fit并对其四舍五入