What is the equivalent of the following in python?
for (i=0; i<n; i++)
for (j=i+1; j<n; j++)
//do stuff with A[i], A[j]
Or in some sense, the following. It should also remove the element from A at the completion of each round of the loop.
for a in A:
for a' in A/{a}: #i.e. rest of the elements of A
#do something with a,a'
#remove a from A
Is there a pythonic way of doing this without using enumerate()?
Edits:
Sorry for the bad description.
In the first example, I mean to use i & j only as indices. Their values do not matter. Its just a rough c++ equivalent of the latter.
The outer loop is executed n times. The inner loop is executed (n-1), (n-2)...0 times for each iteration of the outer loop.
Maybe this might help (pseudocode):
function next_iteration(list):
head = first element
tail = remaining elements #list
each element in tail interacts with head one by one
next_iteration(tail)
PS: All code samples above are pseudocodes. I'm trying to express something that is still a bit vague in my mind.
a.