I have a dictionary with keys from 1 to N. I would like to go through this dictionary with a double for loop so that I don't take two elements at the same time (k goes from 1 to N-1 and j from k+1 to N). I need to this efficiently as I will have to repeat this operation. Is there anyway to do a dictionary comprehension so as to go through the keys as: k goes from 1 to N-1 and j from k+1 to N?