def maxXor( l, r):
return max(a^b for b in range(a,r+1) for a in range(l,r+1))
The error shows NameError: global name 'a' is not defined.
I think the error is range(a,r+1)
Here I want the 'a' in range(a,r+1)
reference 'a' in the inner loop for a in range(l,r+1))
.