human
XOR of all the elements in the given range [ L , R ] | Function to return the required XOR.
Modulus operator are expensive on most of the computers . n & 3 will be equivalent to n % 4 n % 4.
If n is a multiple of 4.
If n % 4 gives remainder 1.
If n % 4 gives remainder 2.
If n % 4 gives remainder 3.
Driver code"
How can the above be solved in Python?

Write me a code to xOR of all the elements in the given range [ L , R ] and the other steps required?
assistant
#Here is code to xOR of all the elements in the given range [ L , R ] and the other steps required.
 def computeXOR ( n ) :
	switch = { 0 : n , 1 : 1 , 2 : n + 1 , 3 : 0 , }
	return switch . get ( n & 3 , " " )
l = 1
r = 4
print ( computeXOR ( r ) ^ computeXOR ( l - 1 ) )