Day 5

作者: Don_t_Panic | 来源:发表于2015-04-12 22:30 被阅读0次

Boolean logic expression

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

所有的布尔逻辑表达式都可以用下面的简单流程得到结果:

  1. 找到相等判断的部分 (== or !=), 将其改写为其最终值 (True 或 False)。
  2. 找到括号里的 and/or, 先算出它们的值。
  3. 找到每一个 not,算出他们反过来的值。
  4. 找到剩下的 and/or,解出它们的值。
  5. 等你都做完后, 剩下的结果应该就是 True 或者 False 了。
3 != 4 and not ("testing" != "test" or "Python" == "Python")
  • True and not ( True or True)
  • True and False
  • False

# <> 和!= 相同,但!= 是主流!

相关文章

网友评论

      本文标题:Day 5

      本文链接:https://www.haomeiwen.com/subject/hnbxfttx.html