• Problem with for and list

Hi everybody,

I have a problem with the for loop and a list.

I am using the cicle for with range, but it does not cover all the elements in a list.

for j in range(inicio_col, fin_col):
    if lista[j] == 1:
        count += 1

for example if I have the following list:

list = (1, 3, 4, 5, 6)

and I want to select the 3rd to 5th elements, I set iniciorow = 2 and fincol = 5. But the for cicle does not take the 5th element.

How can I solve this problem?