--- title: 8.比較運算子與邏輯運算子的說明與實作 tags: python基礎語法與應用, 筆記 --- ### 布林 Boolean 是否 (True, False) 產生是否 1. 數字:>, <, >=, <=, == (相等) 2. 文字:==, in a = True print(a) → True a = 2 == 2 print(a) → True print("apple" == "Apple") → False print("good" in "good morning") → True print("mon" in "good morning") →Flase print("morn" in "good morning") →True ## Boolean 專門 and(而且) or (或者) And 而且(兩個都要滿足) | | True | False | | ---- | ---- | ----- | | True | ✓ T | F | | False| F| F | or 或者 (只要有一項滿足就有) | | True | False | | ---- | ---- | ----- | | True | ✓ T | ✓ T | | False | ✓T | F | --- ## Practice print(“專門結合運算” , True or False) → 專門結合運算 True print(5>3-1 and True) →True ## 程式世界 ## 3個基本資料 1. 數字 2. 文字 3. 是否 ## 2個操縱方式 1. 功能: a)傳入資料 b)回傳答案 2. 運算:+ - * / (左右同類型) ## 1個符號 = 是取名字 # END
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up