scamp_extensions.utilities.sequences.rotate_sequence

scamp_extensions.utilities.sequences.rotate_sequence(s: Sequence, n: int) Sequence[source]

Rotates a sequence s such that it begins with element l[n] and wraps back around to l[n-1].

Parameters:
  • s – the list to rotate

  • n – number of elements to shift by (can be negative and/or greater than the length of l)

Returns:

a “rotated” version of the input sequence