python逻辑量是什么意思_python 逻辑术语

逻辑术语

在 python 中我们会用到下面的术语(字符或者词汇)来定义事物的真(True)或

者假(False)。计算机的逻辑就是在程序的某个位置检查这些字符或者变量组合

在一起表达的结果是真是假。

 and 与

 or 或

 not 非

86

 != (not equal) 不等于

 == (equal) 等于

 >= (greater-than-equal) 大于等于

 <= (less-than-equal) 小于等于

 True 真

 False 假

其实你已经见过这些字符了,但这些词汇你可能还没见过。这些词汇(and, or, not)

和你期望的效果其实是一样的,跟英语里的意思一模一样。

表 真值表

我们将使用这些字符来创建你需要记住的真值表。

NOT       True?

----------------------------------

not False      True

not True      False

=======================

OR          True?

True or False   True

True or True     True

False or True   True

False or False  False

===========================================

AND       True?

---------------------------------

True and False    False

True and True     True

False and True     False

False and False   False

===========================================

NOT OR       True?

----------------------------------

not (True or False)   False

not (True or True)   False

not (False or True)   False

not (False or False)  True

===========================================

NOT AND        True?

-------------------------------------

not (True and False)    True

not (True and True)     False

not (False and True)    True

not (False and False)    True

===========================================

!=           True?

----------------------------------------

1 != 0       True

1 != 1       False

0 != 1       True

0 != 0       False

===========================================

==         True?

1 == 0       False

1 == 1       True

0 == 1       False

0 == 0       True

------------------------------------------

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值