python学习日记_第十一天(ex27~28)
2016-01-15 08:36
495 查看
习题 27: 记住逻辑关系
需要记忆的逻辑符号,最基础的逻辑。初心者向。and 与
or 或
not 非
!= (not equal) 不等于
== (equal) 等于
>= (greater-than-equal) 大于等于
<= (less-than-equal) 小于等于
True 真
False 假
习题 28: 布尔表达式练习
联系的对于布尔值的判断# 1 == True; 0 == False True and True #1 False and True #0 1 == 1 and 2 == 1 #0 "test" == "test" #1 1 == 1 or 2 != 1 #1 True and 1 == 1 #1 False and 0 != 0 #0 True or 1 == 1 #1 "test" == "testing" #0 1 != 0 and 2 == 1 #0 "test" != "testing" #1 "test" == 1 #0 not (True and False) #1 not (1 == 1 and 0 != 1) #0 not (10 == 1 or 1000 == 1000) #0 not (1 != 10 or 3 == 4) #0 not ("testing" == "testing" and "Zed" == "Cool Guy") #1 1 == 1 and not ("testing" == 1 or 1 == 0) #1 "chunky" == "bacon" and not (3 == 4 or 3 == 3) #0 3 == 3 and not ("testing" == "testing" or "Python" == "Fun") #1 -->错了,修正为0
加分项目: 1.Python 里还有很多和 != 、 == 类似的操作符. 试着尽可能多地列出 Python 中的等价运算符。例如 < 或者 <= 就是。 2.写出每一个等价运算符的名称。例如 != 叫 “not equal(不等于)”。 A1&2: 等于 : == 不等于 : != 大于 : > 小于 : < 大于等于 : >= 小于等于 : <= 3.在 python 中测试新的布尔操作。在敲回车前你需要喊出它的结果。不要思考,凭自己的第一感就可以了。把表达式和结果用笔写下来再敲回车,最后看自己做对多少,做错多少。
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python将excel导入到mysql中
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法