python 笔记 布尔表达式练习 《笨办法学Python》习题28 ——1.2
2018-01-02 10:17
393 查看
习题 28:布尔表达式练习
ex28.py
#-*-coding:utf-8-*-
#布尔表达式练习判定
# True and True #True
# False and True #False
# 1 == 1 and 2 == 1 #False
# "test" == "test" #True
# 1 == 1 or 2 != 1 #True
# True and 1 == 1 #True
# False and 0 != 0 #False
# True or 1 == 1 #True
# "test" == "testing" #False
# 1 != 0 and 2 == 1 #False
# "test" != "testing" #True
# "test" == 1 #False
# not (True and False) #True
# not (1 == 1 and 0 != 1) #False
# not (10 == 1 or 1000 == 1000) #False
# not (1 != 10 or 3 == 4) #False
# not ("testing" == "testing" and "Zed" == "Cool Guy") #True
# 1 == 1 and not ("testing" == 1 or 1 == 0) #True
# "chunky" == "bacon" and not (3 == 4 or 3 == 3) #False
# 3 == 3 and not ("testing" == "testing" or "Python" == "Fun") #False
验证:
ex28.py
#-*-coding:utf-8-*-
#布尔表达式练习判定
# True and True #True
# False and True #False
# 1 == 1 and 2 == 1 #False
# "test" == "test" #True
# 1 == 1 or 2 != 1 #True
# True and 1 == 1 #True
# False and 0 != 0 #False
# True or 1 == 1 #True
# "test" == "testing" #False
# 1 != 0 and 2 == 1 #False
# "test" != "testing" #True
# "test" == 1 #False
# not (True and False) #True
# not (1 == 1 and 0 != 1) #False
# not (10 == 1 or 1000 == 1000) #False
# not (1 != 10 or 3 == 4) #False
# not ("testing" == "testing" and "Zed" == "Cool Guy") #True
# 1 == 1 and not ("testing" == 1 or 1 == 0) #True
# "chunky" == "bacon" and not (3 == 4 or 3 == 3) #False
# 3 == 3 and not ("testing" == "testing" or "Python" == "Fun") #False
验证:
相关文章推荐
- python 笔记 if语句中的elif和else 《笨办法学Python》习题30 ——1.2
- python 笔记 if语句的简单使用 《笨办法学Python》习题29 ——1.2
- 笨方法学Python 习题 28: 布尔表达式练习
- python 笔记 练习、加深记忆 《笨办法学Python》习题24 ——12.29
- python 笔记 真和假的逻辑关系 《笨办法学Python》习题27 ——12.31
- python 笔记 函数(function)浅识 (《笨办法学Python》习题18)——12.26
- python 笔记 While 循环 《笨办法学Python》习题33 ——1.7
- python 笔记 小试身手 修正代码 《笨办法学Python》习题26 ——12.31
- python 笔记 函数和变量 《笨办法学Python》习题19 ——12.27
- python 笔记 return的使用 《笨办法学Python》习题21 ——12.28
- python 笔记 基础知识回顾 《笨办法学Python》习题22 ——12.29
- python 笔记 分支和函数《笨办法学Python》习题35 ——1.17
- python 笔记 循环和列表 《笨办法学Python》习题32 ——1.6
- python 笔记 if语句的简单嵌套 《笨办法学Python》习题31 ——1.3
- Python学习笔记: 第五章课后习题练习
- python 笔记 序数和基数《笨办法学Python》习题34 ——1.16
- python 笔记 函数和文件(seek和readline)《笨办法学Python》习题20 ——12.28
- 习题28 布尔表达式练习
- python 笔记 python编译器初识以及split() 、pop()的使用 《笨办法学Python》习题25 ——12.29
- python入门练习笔记_2