天天看點

《笨辦法學python3-Learn Python 3 the HARD WAY》-習題28 布爾表達式練習

學習内容:

書中個别拼寫有問題,運作時會報錯

True and True 
False and False 
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" == "becon" and not (3 == 4 or 3 == 3) 
3 == 3 and not ("testing" == "testing" or "Python" == "Fun")  
           

運作結果:

《笨辦法學python3-Learn Python 3 the HARD WAY》-習題28 布爾表達式練習

繼續閱讀