Python TQC考題302_迴圈偶數連加 by 儲蓄保險王 · 2022-04-28 #Python TQC考題302_迴圈偶數連加 a=eval(input()) b=eval(input()) sum=0 for i in range(a,b+1): if i%2==0: sum+=i #sum=sum+i print(sum) 相關文章Python TQC考題202_倍數判斷, x%3==0(%求餘數) x%5!=0 (!= 不等於)Python: pandas.DataFrame() 在不同資料類型(array/dict)下的 columns 參數用法 #賦值 #選擇Python 邏輯運算子: and(&) or(|) xor(^) not ; assert 預期為真的條件式, "錯誤訊息" ; 條件式為真的話,繼續往下跑,否則AssertionError: "錯誤訊息"Python 非監督式機器學習: 距離導向聚類法(k-Means 演算法); 使用 scikit-learn ; 學生分群 ; from sklearn.cluster import KMeansPython: Visual Studio Code (VS code) & Spyder 如何切換不同版本的Python直譯器( Interpreter ), VS code: 齒輪>命令選擇區(Ctrl + Shift +P) > Python: Select Interpreter #Spyder console: !where python #知道自己安裝的python路徑Python: 如何計算全文件詞頻(term frequency,簡稱TF)?如何使用jieba做中文斷詞? lis_jieba = jieba.lcut(strr)Python TQC考題310 迴圈公式計算Python: listA.extend(listB) 與 listC = listA + listB的差別?Python的財務函數 numpy_financial.rate() ,19歲奧運跆拳銅牌美少女羅嘉翎的國光獎金,應該一次領500萬?還是終身月領2.4萬?Excel財務函數PMT, RATE, NPER, PV, FV
0 Python: matplotlib繪製出的圖表如何插入背景圖? img = plt.imread(‘background_image.png’) ; ax.imshow(img, extent=[0, 10, -1.2, 1.2], aspect=’auto’, alpha=0.5) 2023-02-16
0 Python: matplotlib繪圖如何共用x axis, y axis, x label, ylabel? fig, axs = plt.subplots(nrows=2, ncols=3, sharex=True, sharey=True) ; plt.suplabel() 2023-02-28
0 Python: 前綴f string 格式化字串 hex_string = f’0x{value :02x}’ #:02x or :08b是格式化說明符(format specifier) ; hex() or bin() #轉為16 or 2進位數字,會省略前導0 2023-09-03
近期留言