I have f(a,b) = 0 and want to represent it in NAND form in terms of a and b, but I don’t think is possible.
>Solution :
def NAND(a, b):
return (a & b) ^ 1
def f(a, b):
return NAND(
NAND(a, NAND(a, a)),
NAND(b, NAND(b, b)),
)
for a in 0, 1:
for b in 0, 1:
print(f(a, b))
Output (Attempt This Online!):
0
0
0
0