Well, the error you are talking about occurs here:

- Code: Select all
`while value in range(len(lst[sublist])):`

You defined sublist as an integer here:

- Code: Select all
`sublist = 0`

But then you use sublist as an item to iterate through lst:

- Code: Select all
`for sublist in lst:`

So sublist changes to whatever list in lst you are currently looping through.

The error is that you use a list (sublist) as an index for lst:

- Code: Select all
`while value in range(len(lst[sublist])):`

And list indices cannot be lists.

To avoid that, you should have written:

- Code: Select all
`for sublist in range(len(lst)):`

instead of

- Code: Select all
`for sublist in lst:`

Now your code shouldn't be crashing anymore, BUT:

It's still not working the way you want it to.The problem with your code is that your while loop never ends; this is due to a "fatal" mistake you made

You increment value ONLY in your if-clause:

- Code: Select all
` if lst[sublist][value] % 2 == 0:`

value = value + 1

However, if the first number is odd - value remains 0!

So

- Code: Select all
`while value in range(len(lst[sublist])):`

is always true, and your loop won't progress.

Increment value outside of your if-clause like this:

- Code: Select all
`while value in range(len(lst[sublist])):`

if lst[sublist][value] % 2 == 1:

even_sublist = False;

value += 1

and it should be working.

P.S.:

There is a significantly easier way to do it - as pointed out by micseydel, you have unnecessary loops and variables. However, this should work for now.