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: 如何使用graphviz套件繪製流程圖? from graphviz import Digraph ; dot = Digraph() ; dot.attr(rankdir='TB', size='10,15') #"TB": Top to Bottom, 從上而下的佈局Python 設定與讀取環境變數:以 GEMINI_API_KEY 為例; 如何串接Gemini API?如何傳遞圖片給(Gemini / OpenAI) API? MIME (Multipurpose Internet Mail Extensions)Python: pandas.DataFrame .sort_values() 用簡單例子理解 sort_values() 方法Python: pandas.Series如何只保留str,去除重複值?#isinstance(x:Any, str) -> bool #.drop_duplicates() #Series.apply( function )逐元素應用function運算 #DataFrame.apply( function )逐Series應用function運算 .drop_duplicates() 跟.unique()有何差別? df.drop_duplicates() 等效於 df[~df.duplicated()]Python: 使用 Google Cloud Vision API 的完整教學(含憑證設定); 做OCR (client.text_detection), 標籤偵測 (client.label_detection)... ; pip install google-cloud-vision; from google.cloud import vision ; client = vision.ImageAnnotatorClient()Python 正則表示法 中 ?: 與非捕獲群組的精要筆記, ?的多重語義:量詞0 or 1次, +?非貪婪量詞, ?:非捕獲群組, ?P<name> 命名捕獲組, ?= 正向前瞻 斷言, ?! 負向前瞻斷言Python 檔案搜尋實戰:glob.glob() vs Path.glob() 誰更好用?Python: 正則表示法(regular expression)中的量詞: +*? ; reading="100.000" units="degrees C" ; 如何以空格分割字串,卻不分割"degrees C"中的空格? re.findall(r'(\w+)="([^"]*)"', input_string)Python: 如何計算全文件詞頻(term frequency,簡稱TF)?如何使用jieba做中文斷詞? lis_jieba = jieba.lcut(strr)
0 Python:用numpy.polyfit()與numpy.poly1d()做多項式曲線擬和; matplotlib 如何變更legend圖例字型大小? plt.rc(“legend”, fontsize=16) ; ax.legend(loc = “best”, fontsize=16, handlelength=0.5, frameon = False) 2023-01-12
近期留言