模块1:math库的使用

来自CloudWiki
119.162.11.117讨论2018年2月6日 (二) 03:37的版本 函数库的引用
跳转至: 导航搜索

函数库的引用

  • 两种方式
  • 第1种:
>>>import math
>>>math.ceil(10,2)
  • 第2种:
>>>from math import floor
>>>print(floor(x))
>>>from math import *

math库解析

数学常数

math.pi
math.e
math.inf
math.nan

数值表示函数

math.fabs(x)
math.fmod(x,y):求余数
math.fsum([x,y,...])
math.ceil(x)
math.floor(x)
math.factorial(x)
math.gcd(a,b)

幂对数函数

math.pow(x,y)
math.exp(x)

三角运算函数

math.degree(x)
math.radians(x)
math.sin(x)
math.cos(x)
math.tan(x)

=高等特殊函数

下一节 实例3:天天向上的力量