【发布时间】:2020-06-09 21:43:26
【问题描述】:
我在评估三个布尔变量时试图了解 Python 的行为。
>>> True and True and False == False
True
评估为 'True',这是我所期望的。
然而
>>> True and False and True == False
False
>>> False and True and True == False
False
当我预期 True 时,两者都评估为 'False'。有人可以帮助我了解我在这里缺少什么。我尝试过搜索,但找不到在单个语句中评估 3 个布尔变量的示例。
谢谢!
【问题讨论】:
标签: python-3.x boolean boolean-expression