#executing the XOR gate
print('Enter a truth value for each of the variables and get A XOR B.')
print('Enter A')
a = input()
print('Enter B')
b = input()
print('The XOR gate value is:')
print(((a and (not b)) or ((not a) and b)))
So it's pretty obvious that I'm trying to input Boolean key words True
and False
into variables a
and b
to get the output of an XOR gate.
The issue here is that the input function is evaluating the True
or False
input to be a string instead of a Boolean registered word and the program is always returning False
as the answer.
I would like to know if there is a way to input and store Boolean values in variables.