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: any(list) 判斷list中是否有True ; all(list) 判斷list中是否全為True ; any(pandas.Series)相當於any(pandas.Series.values) ; i in pandas.Series 卻相當於於i in pandas.Series.indexPython爬蟲:BeautifulSoup的.find_all() 與select() ; from bs4 import BeautifulSoup ; .string .text .get_text() 獲取文字內容Python中的文件和路徑操作:使用os.path函數和__file__變數; os.path.split() #一次取得dirname , basename 可以取代os.path.dirname() + os.path.basename() ;分離主/副檔名: os.path.splitext() #split ext ; os.path.join( folder, fname) #將folder, fname合併為完整的路徑Python: 在使用Pandas進行邏輯運算時,應避免使用or運算子,而應使用|運算子(逐元素比對) ,以免觸發ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().Python: 如何錄製wav檔? import sounddevice ; from scipy.io.wavfile import writePython: 正則表示法(Regular Expression) re.search() 和 re.match() 的區別Python如何輸出多分頁的xlsx? with pandas .ExcelWriter ("output.xlsx") as writer:Python TQC考題606: 檢驗學號Python: 如何使用 os.environ["PATH"] 設定環境變數?與 sys.path.append() 差別為何?
0 Python的財務函數 numpy_financial.rate() ,19歲奧運跆拳銅牌美少女羅嘉翎的國光獎金,應該一次領500萬?還是終身月領2.4萬?Excel財務函數PMT, RATE, NPER, PV, FV 2022-10-11
0 Python data = numpy.zeros( (4,6,2), dtype=float) ; print(data.shape); min0 = numpy.min(a,axis=0) ; min1 = numpy.min(a,axis=1) #2次沿軸1 ; numpy.average() ;array的軸向 2022-08-29
0 Python: pandas.DataFrame串接; pandas.concat( [df1,df2] , axis=1, ignore_index=True) ; .append() 產生一個新的DataFrame; 插入欄 .insert() 改變原DataFrame 2022-11-29
近期留言