“笨办法”学Python 3 ——练习 27 记忆逻辑

练习 27 记忆逻辑

知识点:

简单的计算机逻辑关系

逻辑术语

  • and : 与
  • or: 或
  • not:非
  • !=:不等于
  • ==:等于
  • <= :小于等于
  • .>=: 大于等于
  • True : 真
  • False:假

真值表(The Truth Tables)

not

  • not False : True
  • not True : False

or

  • True or False : True
  • True or True : 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 (True or False) : False

  • not (True or True) : False

  • not (False or True) : False

  • not(False or False) : True

  • 1 != 0 : True

  • 1 != 1 : False

  • 0 != 1 : True

  • 0 != 0 : False

  • 1 == 1 :True

  • 1 == 0 : False

  • 0 == 0 : True

  • 0 == 1 : False

记忆技巧

or 有True就是True;
and有False就是False;
not or 有True就是False。
与:是是是,其他都非
或:非非非,其他都是

常见问题

1.我可以只学习布尔代数(boolean algebra)背后的理论而不去记忆这些内容吗?
你当然可以这样做,但是之后你在写代码的时候就得不停地回顾布尔代数的那些规则了。如果你先把这些记住,不仅可以构建你的记忆技巧,还能让你的操作更自然。在这之后,布尔代数的理念就非常简单了。当然了,选择最适合你的方式吧。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值