You are viewing a single comment's thread. Return to all comments →
Very similar to my code. I took the modulus of d but it isn't really necessary because the slice method does it automatically.
n, d = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
d %= n
print(*(arr[d:] + arr[:d]))
Looks the same as the one I wrote before looking at the discussion. As a person who programmed bit sliced arrays, I love python.
nd = input().split()
n = int(nd)
d = int(nd)
a = list(map(int, input().rstrip().split()))
print (a[(i+d)%len(a)], end = ' ')