Loop in Python not giving output -


can see error in code? think should print two1[i], prints nothing.

two1=[1,2,10,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2] count = 0 = 0 while count < 4:     #if == len(two1)-6: break     #else:         if abs(int(two1[i+2]) - int(two1[i+3]))>10 , abs(int(two1[i+4]) -abs(int(two1[i+5]))<10               print two1[i]             count = count + 1             = + 6         if abs(int(two1[i+2]) - int(two1[i+3]))<10 , abs(int(two1[i+4]) -  abs(int(two1[i+5])) > 10:               print two1[i]             count = count + 1             = + 6         else:             count = count + 1             = + 6 

there aren't elements in two1 difference bigger 10. maximum difference 9 between 1 , 10 hence condition:

abs(int(two1[i+2]) - int(two1[i+3]))>10 

is false. means neither first, nor second if executed, else executed.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -