Skip to content

Instantly share code, notes, and snippets.

@sethbunke
Last active July 3, 2018 00:33
Show Gist options
  • Save sethbunke/a5a5f9088a0dd009a2e858638e7e2186 to your computer and use it in GitHub Desktop.
Save sethbunke/a5a5f9088a0dd009a2e858638e7e2186 to your computer and use it in GitHub Desktop.
Python Shift Array Right Lambda
shift_right = lambda arr,n: arr if n == len(arr) else arr[(-1*n):] + arr[:((len(arr)-n))]
print(shift_right([1, 2, 3, 4, 5], 3))
#[3, 4, 5, 1, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment