Python基礎知識
1. 註釋 Comments
# 這是個註解
print("Hello World")2. 函數print() 打印輸出
print("Hello")
print("數值:", 5)3. 變量 Variables 和 賦值 Asignment
x = 10 # 整數 (int)
y = 3.14 # 浮點數 (float)
name = "Cheung Sir" # 字串 (str)
#利用print(type(x))可以列印出變量x的數據類型4. 數據類型 Data Types
5. 簡單運算符號 Operators
6. 函數input() 輸入資料;函數eval() 字串->數值
7. 選擇控制結構
8. 關係/比較運算符 Relational/Comparison operator
運算符
說明
範例
9. 函數format() 或f-string 格式化輸出
10. 函數roud() 四捨五入
Last updated