發表文章

目前顯示的是 10月, 2026的文章

115103143 HW01 Python 環境建立和Hello World

圖片
1.  https://notebook.google.com/notebook/4128868c-0396-4299-a2f5-373114934249 2. 學習卡 3. 4.def temp_converter():     print("=== 溫度轉換器 ===")     print("1. 攝氏 (℃) 轉 華氏 (℉)")     print("2. 華氏 (℉) 轉 攝氏 (℃)")     choice = input("請選擇轉換類型 (1 或 2): ").strip()     if choice == "1":         celsius = float(input("請輸入攝氏溫度 (℃): "))         # 轉換公式:F = C * 9/5 + 32         fahrenheit = (celsius * 9 / 5) + 32         print(f"\n👉 {celsius:.1f}℃ = {fahrenheit:.1f}℉")     elif choice == "2":         fahrenheit = float(input("請輸入華氏溫度 (℉): "))         # 轉換公式:C = (F - 32) * 5/9         celsius = (fahrenheit - 32) * 5 / 9         print(f"\n👉 {fahrenheit:.1f}℉ = {celsius:.1f}℃")     else:         print("輸入無效,請選擇 1 或 2。") if __name__ == "__main__":   ...