- NAND is a logical gate that give output True if any of the input is false.
-NAND is combination gate of AND and NOT gate.
-If we do the NOT of the AND gate then we get the NAND gate.
Truth table of NAND gate-
A | B | A NAND B |
---|---|---|
False | False | True |
False | True | True |
True | False | True |
True | True | False |
def NAND(x,y):
if x==1 and y==1:
return False
else:
return True
print("AtBtA NAND B")
print("False Falset",NAND(0,0))
print("False Truet",NAND(0,1))
print("True Falset",NAND(1,0))
print("True Truet",NAND(1,1))
A B A NAND B
False FalseTrue
False True True
True False True
True True False