I want to rotate elements in a list, e.g. - shift the list elements to the right so [\'a\',\'b\',\'c\',\'d\'] would become [\'d\',\'a\',\'b\',\'c\'], o
[\'a\',\'b\',\'c\',\'d\']
[\'d\',\'a\',\'b\',\'c\']
Use a function assuming n is the shift that is less than the length of list l like so:
n
l
shift = lambda l, n: l[-n:] + l[:-n] # i.e. shift([1, 2, 3, 4], 3)