这是我自己学习的答案,会尽力写的比较好。还望大家能够提出我的不足和错误,谢谢!
文中例题:
True and True
False and True
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" == "bacon" and not (3 == 4 or 3 == 3)
3 == 3 and not ("testing" == "testing" or "Python" == "Fun")
运行结果:
习题答案:
1 和 2、
等价运算符 | 名称 |
---|---|
== | equal |
!= | not equal |
<> | not equal |
> | great than |
>= | great or equal |
< | less than |
<= | less or equal |