1. 程式人生 > >寫程式碼:列舉布林值是False的所有值

寫程式碼:列舉布林值是False的所有值

 1 # encoding: utf-8
 2 
 3 # 列舉布林值是False的所有值
 4 
 5 print("1. ", bool(0))
 6 print("2. ", bool(-0))
 7 print("3. ", bool(None))
 8 print("4. ", bool())
 9 print("5. ", bool(False))
10 print("6. ", bool([]))
11 print("7. ", bool(()))
12 print("8. ", bool({}))
13 print("9. ", bool(0j))
14 print("10. ", bool(0.0))