Logic gates are functions which perform basic logic operations. In this problem, we will account for the following 6 logic gates: AND
, OR
, XOR
, NAND
, NOR
, and XNOR
. Each of these takes two boolean inputs \$ a \$ and \$ b \$, and outputs a boolean. Below are the truth tables which show the output of each gate given two inputs.
Task
Given two boolean inputs \$ a \$ and \$ b \$, return/output a list of the names of all gates which would return a Truthy value. The order doesn't matter, but the names must be in the exact format as given in the 2nd sentence of the above paragraph (not the ones in the diagram). You are also allowed to output them exclusively in lowercase, if desired.
Clarifications
- You may also output a delimiter-separated string
- I will allow leading/trailing spaces
Test Cases
Input
0 0
0 1
1 0
1 1
Output
[NOR, NAND, XNOR]
[OR, NAND, XOR]
[OR, NAND, XOR]
[OR, AND, XNOR]
This is code-golf, so the shortest code in bytes wins!
or and xnor
? \$\endgroup\$