Logic problem: need better logic for desired thruth table.

Tim Chase python.list at tim.thechases.com
Thu May 28 18:02:29 EDT 2015


On 2015-05-28 23:50, Skybuck Flying wrote:
> A = input
> B = input
> C = output
> 
> A B C:
> -------
> F F T
> F T F
> T F T
> T T T
> 
> Surpisingly enough I don't think there is a casual/common operator
> for this thruth table.
> 
> AND does not apply.
> OR does not apply.
> XOR does not apply.

Sounds like you want "a or not b"

>>> print("\n".join("A=%s B=%s: %s" % (a, b, a or not b) for a in (True, False) for b in (True, False)))
A=True B=True: True
A=True B=False: True
A=False B=True: False
A=False B=False: True

-tkc





More information about the Python-list mailing list