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: 二進制的負數如何表示?補數Python: 如何獲取當前的工作目錄? os.getcwd() ; os.path.dirname( os.path.abspath( __file__ ))Tableau如何建立兩個集合,篩選交集的資料?Python如何讀取json檔?dic = json.loads( json_str ) ; json的保留字:null, true, false(區分大小寫,全小寫), null(非"null",非Null)自動轉譯為None, true(非"true",非True)自動轉譯為True(bool), false(非"false",非False)自動轉譯為False(bool);colab如何掛載雲端硬碟? from google.colab import drive ; json檔的decode與encode? json.load() ; json.loads() ; json.dump() ; json.dumps() #s代表string的意思,有s的指令,參數需使用str typePython中的時間處理簡介; timestamp: float = time.time() #獲取時間戳; localtime = time.localtime( timestamp ) #獲取localtime; strftime = time.strftime('%Y-%m-%d %H:%M:%S', localtime) #獲取strftime #str format timePython: 如何使用selenium自動開啟Chrome瀏覽器,輸入關鍵字後,按ENTER,搜尋圖片? 如何抓下所有大圖?JSON 值可以是以下之一:String, Number, Boolean (true, false), Null (null), Object(對應python的dict), Array(對應python的list); Python如何讀取json檔?Python: 如何在Excel儲存格中自動換行? cell.alignment = openpyxl.styles.Alignment( wrapText =True) #pd.DataFrame.from_dictPython: 如何計算全文件詞頻(term frequency,簡稱TF)?如何使用jieba做中文斷詞? lis_jieba = jieba.lcut(strr)
0 Python繪製hlines , vlines , axhline , axvline , axline ; import matplotlib.pyplot as plt ; plt.hlines(y, xmin, xmax,color=”b”) ; plt.vlines(x, ymin, ymax,color=”r”) 2022-09-12
0 Python: matplotlib如何設定座標軸刻度? plt.xticks(seq, labels) ;如何生成fig, ax物件? fig = plt.figure(figsize= (10.24, 7.68)) ; ax = fig.add_subplot() ; fig, ax = plt.subplots(figsize=(10.24, 7.68)) ; 如何使用中文? plt.rcParams[“font.family”] = [“Microsoft JhengHei”] 2023-02-08
0 Python: matplotlib如何控制legend的位置? ax.legend(handles=[patch], loc=’upper left’, bbox_to_anchor=(6/10, 3/5) 2023-05-01
近期留言