import math
print(math.trunc(3.485))#取整數
print(math.pow(3,4))#乘方
print(math.pi)
print(math.sqrt(100))#開方
print(math.log(10))#e為底,10的自然對數
print(math.log(10,3))#e為底,10的自然對數
複制
3
81.0
3.141592653589793
10.0
2.302585092994046
2.095903274289385
import math
print(math.fmod(20,3))#取餘
print(math.fsum([12,56,3,4]))#疊代器求和
print(math.factorial(5))#階乘
print(math.fabs(-9.23))#取絕對值
print(math.exp(5))#e(2.71829)的5次方
複制
2.0
75.0
120
9.23
148.4131591025766
import math
print(math.degrees(math.pi/4))#弧度轉角度
print(math.tan(math.pi/6))#弧度的正切值
print(math.cos(5))##弧度的餘弦值
print(math.floor(9.23))#<=x的最大值
print(math.ceil(9.23))#>=x的最小值
複制
45.0
0.5773502691896256
0.2836621854632263
9
10