【问题标题】:not not not not True evaluates True, how? [closed]not not not not True 评估 True,如何? [关闭]
【发布时间】:2023-02-21 11:28:50
【问题描述】:

为什么 not not not not True 评估为 True?不太明白它的逻辑,如果有人能帮助我理解它会很好。谢谢

我想看看这个表达式背后的逻辑。

【问题讨论】:

  • 该表达式与 not (not (not (not True))) 相同,然后从最里面的括号向外计算。
  • 2 not相互抵消。
  • 每个not 将布尔值从True 翻转为FalseFalseTrue。一次一个地完成nots,没有理由不这样做。
  • 你明白为什么not TrueFalse吗?那你明白为什么not not TrueTrue了吗?

标签: python


【解决方案1】:

not 运算符将给出其后的值的反向结果。那么,结果应该是:

  • 正确 --> 正确
  • 不正确 = 错误
  • not not True = not(not True)= not False = True
  • not not not True = not (not not True) = not True = 假
  • not not not not True = not (not not not True) = not False = 真

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-23
    • 2022-12-01
    • 1970-01-01
    • 2015-08-26
    • 2016-02-15
    • 2015-10-10
    相关资源
    最近更新 更多