Python TQC考題206_等級判斷, if 條件1:動作1 elif 條件2:動作2, else: 動作n,==為邏輯判斷式,=為指定 by 儲蓄保險王 · 2022-04-27 #Python TQC考題206_等級判斷 score=eval(input()) if score >= 80: print(“A”) elif score >= 70: print(“B”) elif score >= 60: print(“C”) else: print(“F”) Spyder執行結果 相關文章Python: Regular Expression 正規表示法 正則表達式 import re ; pattn = "[\d]{4}\/[01][\d]\/[0123][\d] [\d]{6}" ; match = re .search (pattn,text) .group()Python: 如何使用random.sample 從10個號碼中挑出不重複的三個號碼; random.shuffle弄亂十個數字的順序後,挑選前三個數字Python .encode() 字符串編碼與轉換,ord()函數求得chr的ASCII碼,struct.pack()Python: 使用刪節號ellipsis 切片 numpy.ndarrayPython: matplotlib如何繪製出副刻度?minor_locator = ticker.MultipleLocator(0.5) ; ax.xaxis.set_minor_locator(minor_locator)Python: pandas.DataFrame 如何找出重複值並計算重複次數? counts = df[duplicates] .groupby(['name']) .size() .reset_index(name='count')Python: 如何用scipy.interpolate做內插? from scipy.interpolate import interp1d ; f = interp1d(x, y) ; 如何用numpy.polyfit() 做外插?Python: Visual Studio Code (VS code) 程式碼input(),終端機卻無法輸入資料且顯示亂碼,該如何設定?齒輪 > 設定,搜尋: run in terminal, 打勾: Wether to run code in integrated Terminal.Python GUI: 如何使用tkinter建立垃圾桶icon (Unicode: "\U0001F5D1")的Button?一按就刪除掉Label + Entry + Button ; trash_icon = tk.PhotoImage( file = trash_icon_path)
0 Python: 檔名:14.5GHZ.csv 如何依據.csv的.做split(),但.5GHZ的.不split()? parts = filename.rsplit(“.”, 1) ; 使用正則表示法parts = re.split(r”\.(?!\d)”, filename) 2023-05-29
近期留言