發表文章

圖片
  HW02 運算子表達式 1. Notebook 2.YT 3. 學習卡 與測驗 4. # === 1. 算術運算子 (Arithmetic Operators) ===   a = 10 b = 3    print( "--- 算術運算 ---" )  print( f"加法: {a} + {b} = {a + b} " ) print( f"減法: {a} - {b} = {a - b} " )  print( f"乘法: {a} * {b} = {a * b} " )  print( f"除法: {a} / {b} = {a / b} " )  print( f"整數除法 (商): {a} // {b} = {a // b} " )  print( f"取餘數 (模數): {a} % {b} = {a % b} " )  print( f"次方: {a} ** {b} = {a ** b} " )                  # 10的3次方   # === 2. 比較運算子 (Comparison Operators) - 結果為布林值 (True/False) ===   print( "\n--- 比較運算 ---" )  print( f" {a} 是否大於 {b} ? {a > b} " )   print( f" {a} 是否等於 {b} ? {a == b} " )  print( f" {a} 是否不等於 {b} ? {a != b} " )  # === 3. 邏輯運算子 (Logical Operators) ===   x = True   y = False   print( "\n--- 邏輯運算 ---" )  print( f"True and False -> {x and y} " )     # 兩者皆為 True 才為 True   prin...
圖片
Python五選一心得 Python 自動化的樂趣|搞定重複瑣碎&單調無聊的工作 這網站全免費且範例超實用,零基礎也能現學現賣,用 Python 搞定 Excel、抓資料等繁瑣雜務,是告別重複人工的最強自學寶庫! https://automatetheboringstuff.com/
圖片
  HW #01 Python 環境建立和Hello World 1. Notebook 2.YT 3. 學習卡 與測驗 4. def split_bill():     print("=== 聚餐 AA 制分帳小工具 ===")     try:         # 輸入總金額         total_amount = float(input("請輸入帳單總金額(元):"))         # 輸入用餐人數         people_count = int(input("請輸入分攤人數:"))         if people_count <= 0:             print("人數必須大於 0!")             return         # 服務費或小費(例如 10%)         tip_percent = float(input("請輸入服務費比例(%,無則填 0):"))         # 計算總金額與每人分攤金額         final_total = total_amount * (1 + tip_percent / 100)         per_person = final_total / people_count         print("\n--- 計算結果 ---")         print(f"含服務費總額:{final_total:.1f} 元")         print(f"每人應付金額:{pe...
圖片
 HW #00 python基礎 1. Notebook 2.YT 3. 學習卡 和測驗 4.不知道怎麼做了