# 0221 ## 一、import 匯入 math 數學工具箱 >import math print(math.cos(30)) >import math print(math.floor(4.5)) print(math.log(3)) > x = min(5, 10, 25, 60, 70) y = max(5, 10, 25, 90) print(x) print(y) #把5,10,25,60,70當作參數傳入min這個函數中 運算出來的解果 設定給y 結果傳入print 然後印出來 >絕對值 >x= abs(7) print(x) >次方 x = pow(4, 3) print(x) >開根號 import math a=(math.sqrt(7)- math.sqrt(5))/(math.sqrt(7)+ math.sqrt(5)) b=math.pow print(a) ## 二、上課筆記 >#Import math library #匯入math模組 import math #Round a number upward to its nearest integer #把1.4當作參數,傳入到math.ceil()函數中 x = math.ceil(1.4) #Round a number downward to its nearest integer #把1.4當作參數,傳入到math.floor()函數中 y = math.floor(1.4) print(x) print(y) >天花板(範圍最高)整數 地板(範圍最低)整數 import math x = math.sqrt(64) print(x)
{"metaMigratedAt":"2023-06-16T22:03:43.153Z","metaMigratedFrom":"Content","title":"0221","breaks":true,"contributors":"[{\"id\":\"4dfebb48-62e3-4093-b22e-bde00bb0bc86\",\"add\":727,\"del\":0}]"}
Expand menu