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.095903274289385ide
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.4131591025766code
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
10it