This is some code that I wrote up to generate a set of numbers;
def _tnry(x,y,z):
    a = None
    if((y == 0 & z == 0) | (x == 0 & y == 0) | (x == 0 & z == 0)):
        a = 1
    if((y == 1 & z == 1) | (x == 1 & y == 1) | (x == 1 & z == 1)):
        a = 2
    if((y == 2 & z == 2) | (x == 2 & y == 2) | (x == 2 & z == 2)):
        a = 0
    print(x,y,z,'ternary =',a )
I am having some problems with the output when you give the input of the following:
_tnry(0,1,2)
_tnry(0,2,1)
_tnry(1,0,2)
_tnry(1,2,0)
_tnry(2,0,1)
_tnry(2,1,0)
As far as I can see in my code a should not ever come out as being equal to 0, 1 or 2. I want to force it to always be None in the examples given.
All other output from the script is how I want it to come out.
 
     
     
     
     
    
|and&. A good explaination is at the following link [https://stackoverflow.com/questions/132988/is-there-a-difference-between-and-is-in-python](https://stackoverflow.com/questions/132988/is-there-a-difference-between-and-is-in-python) – Whitequill Riclo Aug 10 '17 at 04:17