I'm trying to create a list (b) that is list (a) rotating a's members k times to the left. I came up with this on Python 3:
n = 5
k = 4
a = [1,2,3,4,5]
b = []
for i in a:
    if (i + k) <= (n - 1):
            b.append(a[i+k])
        elif (i+k-n) < (n-1):
                b.append(a[i+k-n])      
print(b) 
But for some reason, it doesn't work since when I tell print(b) it returns a list that is exactly like list a
What am I missing here?
 
    