I have the following code.
for k in range( ( N + 1 ) * K ):
if k >= 0 and k <= K-1:
# do something
# n = 0
elif k >= K and k <= 2*K-1:
# do something
# n = 1
elif k >= 2*K and k <= 3*K-1:
# do something
# n = 2
...
...
The 'do something' is complicated to explain but I replaced it with the affectation n = p.
How can I write this explicitly?
More specifically, if k is in the set {p*K,...,(p+1)*K-1} for p = 0 to N, then do something. How can I do it in a code?
n = k//K