7种逻辑操作符
3种布尔运算操作符
2种布尔值

意外收获

在【iterm终端】按 command + d 会将页面增加为两个!
继续在【iterm终端】按 command + d 会将页面增加为三个!
image.png

【bug】

拼写错误:true✅ ture❌
拼写错误:fause❌false✅

【bug】

电脑无法输出【英文大写字母】,怎么调呢?

作业六

作业6
先为下面的每一个逻辑问题写出你的答案,每一题的答案要么为True,要么为False。写完以后,在终端中启动Python,录入这些逻辑语句,确认你写的答案是否正确。

1.True and True #true
2.False and True #false
3.1 == 1 and 2 == 1 #false
4.”test” == “test” #true
5.1== 1 or 2 != 1 #true
6.True and 1 == 1 # true
7.False and 0 != 0 #false
8.True or 1 == 1 #true
9.”test” == “testing” #false
10.1 != 0 and 2 == 1 #false
11.”test” != “testing” #true
12.”test” == 1 #false
13.not (True and False) #true
14.not (1 == 1 and 0 != 1) #false
15.not (10 == 1 or 1000 == 1000) #false
16.not (1 != 10 or 3 == 4) ~~#true ~~#false
17.not (“testing” == “testing” and “Zed” == “Cool Guy”) #true
18.1 == 1 and not (“testing” == 1 or 1 == 0) #true
19.”chunky” == “bacon” and not (3 == 4 or 3 == 3)#false
20.3 == 3 and not (“testing” == “testing” or “Python” == “Fun”)#false

提示用户输入用户名和密码,
用户名等于”Quentin”且
密码等于”btc123”
就输出登录成功,
否则就登录失败。

作业过程

首先,记录自己的答案,使用终端验证。
打开终端,在任意文件夹下运行 python3
开始输入作业,验证自己的答案。

作业结果

5题错误,在终端得到正确答案。
image.png
image.png

第二题

提示用户输入用户名和密码,
用户名等于”Quentin”且
密码等于”btc123”
就输出登录成功,
否则就登录失败。
image.png
image.png