I have a list: fruits = ['apple', 'orange', 'blueberry', strawberry']
How do I create loops such that one index depends on another:
for i in range(len(fruits)):
for j range(len(fruits[i+1:])):
print i,j
I want to print out the pairs:
'apple', 'orange'
'orange', 'blueberry'
'blueberry', strawberry'
'orange', 'blueberry'
etc...
I would like to obtain loops that correspond to the c++ language:
for(i=0;i<5;i++)
for (j=i+1; j<5; j++)
print i, j