AND gate implement in python by R4R Team

-AND is a logical gate that give output True when all the input is True.

Truth table of AND gate-

A B A and B
False False False
False True False
True False False
True True True


program-

def AND(x,y):
if x==1 and y==1:
return True
else:
return False

print("AtBtA.B")
print("False Falset",AND(0,0))
print("False Truet",AND(0,1))
print("True Falset",AND(1,0))
print("True Truet",AND(1,1))


output-

A B A.B
False FalseFalse
False True False
True False False
True True True


-In this program, we create a function 'AND(x,y)' which return True when all input is True.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!