input("x:") 提示输入
raw_input("x:")
pow(2,3) 2的3次方
abs(-10) -10的绝对值
round(1.0/2) 1.0/2的四舍五入
raw_input("x:")
pow(2,3) 2的3次方
abs(-10) -10的绝对值
round(1.0/2) 1.0/2的四舍五入
>>> import math
>>> math.floor(32.9) # 取最接近,但小于的整数
32.0
>>> math.ceil(32.4) # 和floor相反
33.0
>>> from math import sqrt
>>> sqrt(9)
3.0
>>> import cmath # complex math, 复数
>>> cmath.sqrt(-1)
1j
本文介绍了Python中基本的数学运算、科学计算库及其应用,包括整数、浮点数操作,数学函数如平方根、绝对值、四舍五入等,以及复数运算和特殊数学库的使用。

被折叠的 条评论
为什么被折叠?



