發表文章

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

判斷敘述式

圖片
 1. notebook 2.影片栽要 3.測驗 4. 學習卡 5.115103138%5+1 Square Numbers Ending in 5 📌 Problem Description Write a program to calculate the square of a number only if its least significant digit (the last digit) is 5 . If the number ends in 5 , the program calculates and displays its square. Otherwise, the program informs the user that the number does not end in 5 . 💡 Example Example 1: Enter the number: 25 Square = 625 Example 2: Enter the number: 13 The number does not end in 5. 🧠 Algorithm Ask the user to enter an integer. Use the modulo operator ( % ) to check the last digit of the number. If number % 10 == 5 , calculate the square of the number. Display the result. Otherwise, display a message indicating that the number does not end in 5 . 💻 Source Code (C) #include <stdio.h> int main() { int number; printf("Enter the number: "); scanf("%d", &number); if (number % 10 == 5) { printf("Square = %d\n", number * number); ...

python運算子表達式

圖片
 1. notebook 2.影片栽要 3.測驗 4. 學習卡 5. weight = int ( input ( 'Enter the weight of object in kilogram:' )) pounds = weight * 2.20 Tonne = weight * 0.001 print ( 'Weight =' , weight, 'Kilograms' ) print (weight, 'kg = %.2f ' % pounds, 'pounds' ) print (weight, 'kg = %.2f ' % Tonne, 'Tonne' ) 執行結果 text Enter the weight of object in kilogram:100 Weight = 100 Kilograms 100 kg = 220.00 pounds 100 kg = 0.10 Tonne 程式說明 input() :讓使用者輸入物體的重量。 pounds = weight * 2.20 :將公斤換算成磅。 Tonne = weight * 0.001 :將公斤換算成公噸。 %.2f :將結果顯示至小數點後兩位。

python tutor

圖片
  心得 這次使用 Python Tutor 讓我對程式設計有了更直觀的了解。透過一步一步的程式執行過程,可以清楚看到變數、物件與記憶體的變化,比單純閱讀程式碼更容易理解。這個工具也能幫助我找出程式錯誤,讓學習程式變得更有趣、更有效率。

Python 環境建立和Hello World

圖片
Python 環境建立和Hello World 1. https://notebook.google.com/notebook/1ba5d72f-107b-430c-af57-1ec3606f218f 2.影片 3.圖片 4. 學習卡 5.程式碼 Python Hello World 這是一個使用 Python 撰寫的簡單 Hello World 程式,適合 Python 初學者用來了解基本的程式輸出。 📌 程式碼 print("Hello, World!") 📖 程式說明 這段程式使用 Python 的 print() 函式,在螢幕上輸出文字。 print() print() 是 Python 內建的輸出函式,可以將文字、數字或其他資料顯示在終端機(Terminal)中。 例如: print("Hello, World!") 執行後會得到: Hello, World! 其中: print :Python 的輸出函式 "Hello, World!" :要輸出的文字 () :用來放入要傳給 print() 的內容 🚀 如何執行 1. 安裝 Python 先確認電腦已經安裝 Python: python --version 或: python3 --version 2. 建立 Python 檔案 建立一個名為: hello.py 的檔案,並加入: print("Hello, World!") 3. 執行程式 在終端機進入檔案所在的資料夾後執行: python hello.py 執行結果: Hello, World! 📁 專案結構 python-hello-world/ ├── hello.py └── README.md 🎯 學習目標 透過這個簡單的程式,可以學習: Python 基本語法 print() 函式 Python 檔案的建立與執行 GitHub 專案 README 的基本格式 📝 License This project is for learning purposes. []