Elsewhere you've constructed lists of a certain length like this:
    [0] * length
but here you're doing it differently. Personally I find
    [0 for x in range(length)]
to be more pythonic (although it *is* a little strange introducing a variable and not using it like that), but the first way is fine, too. Please pick one way to do it throughout, though.