【发布时间】:2014-11-29 19:41:27
【问题描述】:
有没有办法简化:
if x == 1 and y == 2 and z == 3:
if x == 1 and y == 1 and z == 1:
if x == 1 or y == 2 or z == 3:
if x == 1 or x == 2 被简化为if x in [1, 2]:
【问题讨论】:
-
使用德摩根的规则?
-
是的,非常感谢!
标签: python-3.x simplify simplification