from collections import deque
N = 7
K = 3
test = []
answer = []
for i in range(1, N+1):
test.append(i)
test = deque(test)
while test:
test.rotate(-(K-1))
answer.append(test.popleft())
print(answer)
To embed this project on your website, copy the following code and paste it into your website's HTML: