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 MRO 完全攻略:當兒子繼承了多個富爸爸,該聽誰的?—— 深入理解 Method Resolution Order (MRO) 與 C3 線性化算; 物件導向:多型Python: 如何用tkinter做出Listbox列表選擇框 GUI? menu = tk.StringVar(root, value= tuple( cable.items() ) ) ; listbox = tk.Listbox (root, listvariable = menu)Python-docx 進階手術室:從底層 XML 到超連結混合技; from docx.opc.constants import RELATIONSHIP_TYPE as RT ; part = doc.part ; r_id = part.relate_to(url, RT.HYPERLINK, is_external=True)Python: random產生隨機不重複的數字list ; random.shuffle() ; random.sample() ; 撲克牌洗牌Python: 如何使用 pandas.DataFrame.plot 繪圖? ax=df.plot( subplots=False ) ; plt.subplots_adjust( hspace=1 ) 調整子圖間的間距Python zipfile 全攻略:實作讀寫、解壓、重建,以及 write/writestr 的正確用法; with zipfile.ZipFile(zip_path, mode="r") as z: print(z.namelist()) ; z.infolist()Python: any(list) 判斷list中是否有True ; all(list) 判斷list中是否全為True ; any(pandas.Series)相當於any(pandas.Series.values) ; i in pandas.Series 卻相當於於i in pandas.Series.indexPython機器學習: 決策樹 (DecisionTreeClassifier) ; from sklearn.tree import DecisionTreeClassifier ; tree = DecisionTreeClassifier(criterion = "gini") #criterion = “entropy” #criterion: 標準,準則Python 高階函數三劍客: map、filter、reduce #以函數作為參數,或回傳函數的函數; list(filter(None, data)) ; reduce( lambda acc, x: acc + x, map(lambda x: x * 2, filter(lambda x: x % 2 == 0, numbers)))
0 Python 如何用 Mistune 將 Markdown (md)轉成 AST (Abstract Syntax Tree , 抽象語法樹)並匯出成 JSON; markdown = mistune.create_markdown( renderer=’ast’ ) 2025-07-17
近期留言