Friends, I have a list. I have to do some comparison of each item in the list with each other items in the list.
from numpy import zeros a=zeros((5,5)) myres=['R', 'N', 'L', 'C', 'M'] DON=['R','N','L'] ; ALL=['R','L','M','S'] for x in myres: for y in myres: if x in DON: if y in ALL: a[res.index(x),res.index(y)] = 1 else: continue But here the value of y changes sequentially. I want y to cycle through the list something like the following. Is there any function to do such circular iteration. cycle 1 y's value should be 'N', 'L', 'C', 'M, 'R' index 1,2,3,4,0 of myres cycle 2 y's value should be 'L', 'C', 'M, 'R', 'N' index 2,3,4,0,1 ,, cycle 3 y's value should be 'C', 'M', 'R', 'N','L' index 3,4,0,1,2 ,, Thank you, Bala
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor