第26课没有啥内容,完全不用在意!
第27课主要是讲逻辑术语!
逻辑术语:
在python中会使用下面的术语(字符或词汇)来定义事物的真(True)或假(False)。
计算机的逻辑就是在程序的某个位置检查这些字符或者变量组合在一起表达的结果是真是假。
- and :与
- or :或
- not :非
- != :不等于
- == :等于
- >= :大于等于
- <= :小于等于
- True :真
- False :假
这些字符其实你已经见过了,但这些术语你可能还没见过。这些术语和你期望的效果其实是一样的,跟英语里的意思一模一样。
真值表:
我们将使用这些字符来创建你需要记住的真值表。
not(非假即真,非真即假) | 真假 |
---|---|
not False | True |
not True | False |
or(或,一方为真即为真) | 真假 |
---|---|
True or False | True |
True or Ture | True |
False or True | True |
False or False | False |
and(与,同时为真方为真) | 真假 |
---|---|
True and False | False |
True and True | True |
False and True | False |
False and False | False |
not or(not、or结合) | 真假 |
---|---|
not (True or False) | False |
not (True or Ture) | False |
not (False or True) | False |
not (False or False) | True |
not and (not、and结合) | 真假 |
---|---|
not (True and False) | True |
not (True and True) | False |
not (False and True) | True |
not (False and False) | True |
!=(不等于) | 真假 |
---|---|
1 != 0 | True |
1 != 1 | False |
0 != 1 | True |
0 != 0 | False |
==(等于) | 真假 |
---|---|
1 == 0 | False |
1 == 1 | True |
0 == 1 | False |
0 == 0 | True |
先把这些逻辑做个表格,然后慢慢去记下来,达到熟练的程度!!!