Python TQC考題504 次方計算,def compute(x,y):return x**y by 儲蓄保險王 · 2022-04-29 def compute(x,y): return x**y x=eval(input()) y=eval(input()) ans=compute(x,y) print(ans) “”” 簡單到無需自定義函數 只是練習如何自定義函數 14, 3是使用者input() 不要直接寫進去 compute(14,3) “”” 相關文章Python: 如何調整輸出的xlsx檔,套用最適col width / row height? cell.alignment = Alignment( wrap_text = True)Python 機器學習: RandomForestRegressor 隨機森林迴歸器詳解; from sklearn.ensemble import RandomForestRegressorPython爬蟲: Selenium 的 expected_conditions 與 例外狀況; from selenium.webdriver.support import expected_conditions as EC ; from selenium.common.exceptions import NoSuchElementException, TimeoutExceptionPython pandas: 高效數據重構(樞紐分析) — 使用 groupby("Name").cumcount, set_index 與 unstack 將長格式轉為寬格式Python爬蟲: 理解 response.text 與 BeautifulSoup 對象之間的關鍵區別 from bs4 import BeautifulSoup as bs ; response = requests.get(url) ; soup = bs(response.text) ; bs4.element.Tag .find_all() ; .select() ; .find() 差別為何?soup是大HTML, tag是小HTML,可以使用相同的方法Python 正則括號五兄弟:捕獲 / 非捕獲 / 命名 / 正向前瞻 / 負向前瞻 ( … )捕獲組, (?: … )非捕獲組, (?P … )命名捕獲組, (?= … )正向前瞻斷言, (?! … )負向前瞻斷言Python: Pandas的apply() 解析: DataFrame.apply() 逐Series操作; Series.apply() 逐元素操作 ; SeriesGroupBy_object .apply() 逐Series操作 ,請勿混淆Series.apply() 逐元素操作Python: 如何串接Meta API ?如何將dict存成JSON檔? json.dump(dic_msg ,f , ensure_ascii=False ,indent=4)Python 堆疊演算法實作:從扁平標題清單快速建立階層父子關係
近期留言