Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

xor string python

def XOR(string1, string2, testString):
	return ((string1 == testString or string2 == testString) and not (string1 == testString and string2 == testString))

#Explanation:
#XOR is exclusive or, i.e. or but not and. This is implemented above, as
#if either string1 is whatever to test against or string2 is, but they are
#not both equal to testString.
#So: If string1 = testString XOR string2 = testString, return of XOR function is True.
 
PREVIOUS NEXT
Tagged: #xor #string #python
ADD COMMENT
Topic
Name
6+7 =