I have the following:
P= Permutations(3)
for i in (1 .. 3):
    for u in (1 .. 3):
         for j in (1 .. 3):
              for v in (1 .. 3):
                   if i < j or i > j:
                        if u < v or u > v:
                             p[i,j, u,v] = [1 if P[m][i-1] == u and P[m][j-1] == v else 0 for m in (0 .. 5)]
I was wondering if I some way I can exchange the lines ' if i < j or i > j' and 'if u < v or u > v' for some command that says 'if i ≠ j' and 'if u ≠ v'.
 
 