python range of K and N code example
Example 1: for i in range start
for i in range([start], stop[, step])
Example 2: python range from n to 0
range(N, -1, -1) is better
for i in range([start], stop[, step])
range(N, -1, -1) is better