I'm trying to make a dictionary of pairs of values, but I don't want it added if the pair is already there (even reversed). So let's say (0,1) is already there, I don't want (1,0). This is my code but I'm looking for a more pythonic way of doing it, I'm sure there is one. PS. I can't use itertools for this exercise
test = {(0,1):1, (0,2):2}
for a in range(3):
for b in range(3):
if a!= b:
if (b,a) not in test:
test[a,b]=4