《笨方法學 Python 3》28.布林表示式練習
阿新 • • 發佈:2018-12-10
上節課的邏輯組合的正式名稱是“布林邏輯表示式”,這節課我們要為下面的每一個邏輯寫出答案,然後啟動python,在終端錄入這些題目,確認你的答案是否正確!
基礎練習:
True and False False and True 1 == 1 and 2 == 1 "test" == "test" 1 == 1 or 2 != 1 True and 1 == 1 False and 0 != 0 True or 1 == 1 "test" == "testing" 1 != 0 and 2 == 1 "test" != "testing" "test" == 1 not (True and False) not (1 == 1 and 0 != 1) not (10 == 1 or 1000 == 1000) not (1 != 10 or 3 == 4) not ("testing" == "testing" and "zed" == "Cool Guy") 1 == 1 and not ("testing" == 1 or 1 == 0) "chunky" == "bacon" and not (3 == 4 or 3 == 3) 3 == 3 and not ("testing" == "testing" or "Python" == "Fun")
我的答案:
False
False
False
True
True
True
False
True
False
False
True
False
True
False
False
False
True
True
False
False