For loop in python (Simple)

Viewed 840

I have a really really simple question that I struggle with :)

I need to iterate over list of truples in means of lower triangle matrix in python


python code

dataset = #list of truples

for i, left in enumerate(dataset):
  for j, right in enumerate(dataset):
    if j <= i : continue    #fixme there should be a better way
    foo(left,right)

target pseudo code

for( i=0; i<size; i++ )
  for( j=i; j<size; j++ )
    foo(data[i],data[j])

Thank you very very much :)

2 Answers
Related