Using a list or tuple is possible just by using slice indexing.
>>> a = [1,2,3]
>>> a[1:]+a[:1]
[2, 3, 1]
>>> [*a[1:],*a[:1]] #or if you prefer..
[2, 3, 1]
using the extend
method would be something like this:
>>> a = [1,2,3]
>>> b = a[1:]
>>> b.extend(a[1:])
>>> b
[2,3,1]
as the other answer suggested you could use np.roll(x,-1,axis=0)
with numpy
to iterate you simply do a for loop and it's done:
a = [1,2,3]
b = a[:1]
b.extend(a[1:])
for x in b:
print(x,end=' ')
# 2 3 1
or you could use the modulo operator:
from functools import partial
mod = lambda x,y:x%y
a = [1,2,3]
l = len(a)
for x in map(partial(mod,y=l),range(l+1)):
print(a[x],end=' ')
>>> 2 3 1