Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
print (a[len(a)-s:] + a[:-s])
or
just
print (a[-s:] + a[:-s])
the element that will be the first, and the final position - the element that will be FOR the last is indicated.
What would work with any step is useful offset normalize modulo length:
s %= len(a)
print (a[-s:] + a[:-s])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question