56.5k views
0 votes
Write a logical expression using only and, or and not that is equivalent to the Exclusive NOR (XNOR) gate on 2 inputs, called in1, in2: If both inputs are True or both inputs are False (i.e. inputs have same value), then your expression should evaluate to True. Otherwise your expression should evaluate to False.

1 Answer

3 votes

Answer:

in1 = int(input("Enter value one: "))

in2 = int(input("Enter value two: "))

print(in1,type(in1), in2, type(in2))

if (in1 <=0 and in2 <=0) or (not in1 <=0 and not in2<=0):

print( True)

else:

print( False)

Step-by-step explanation:

The if statement of the python source code is used to implement an Exclusive-NOR logic gate that gives a true or high value if both inputs are either true or false.

User TechBeginner
by
6.3k points