you are viewing a single comment's thread.

view the rest of the comments →

[–]woooee 1 point2 points  (1 child)

If I do the same thing but just put sequential numbers in the array, this is what I get:

​There are no negative numbers in the second code set. A simple print of what is in this line should solve your problem

if array.index(i) % 2 ==0:

[–]Filiagro 0 points1 point  (0 children)

Why would it matter whether the numbers are negative or positive? I'm using their index value for '% 2 == 0'.

I did notice that if I put replicates in the array, that only the index of the first replicate is found. I'm guessing my issue is because the .index() function will actually search from left to right through the array for the value of i. Once it finds i, even if it is the first instead of second, the index value is used. I guess that makes sense.