0

I have very big lists of more than 500 elements so I will minimise the example to make the visualisation easier, say I have:

a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

and I was to have a function to which I give a list and a number of places to switch the elements clockwise of the form:

def transpose_by_n(list, n):
    pass

The result of

transpose_by_n(a, 1) will be 
a = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]

and the result of

transpose_by_n(a, 5) will be 
a = [6, 7, 8, 9, 10, 1, 2, 3, 4, 5]

Thanks

cs95
  • 330,695
  • 80
  • 606
  • 657
hack-is-art
  • 305
  • 3
  • 19

0 Answers0