In [1]:
xs = [1,2,3,4]
ys = [10,20,30,40]
for x in zip(xs,ys):
    print(x)
(1, 10)
(2, 20)
(3, 30)
(4, 40)
In [ ]:
[1,2,3,4,5]
rotate right by 3 positions
[3,4,5,1,2]
In [2]:
s = [1,2,3,4,5]
s[3:] + s[:3]
Out[2]:
[4, 5, 1, 2, 3]
In [3]:
def rotate(n,s):
    return s[n:] + s[:n]
In [4]:
rotate(3,[1,2,3,4,5])
Out[4]:
[4, 5, 1, 2, 3]
In [ ]: