Codewars 8 kyu Exclusive "or" (xor) Logical Operator
Task
In some scripting languages like PHP, there exists a logical operator (e.g. &&, ||, and, or, etc.) called the "Exclusive Or" (hence the name of this Kata). The exclusive or evaluates two booleans. It then returns true if exactly one of the two expressions are true, false otherwise.
Verbalization
ひとつひとつ条件付けする
#Code
def xor(a,b):
if a == False and b == False:
return False
if a == False and b == True:
return True
if a == True and b == False:
return True
if a == True and b == True:
return False
Other example
def xor(a,b):
return a != b