Last active
July 3, 2018 00:33
-
-
Save sethbunke/a5a5f9088a0dd009a2e858638e7e2186 to your computer and use it in GitHub Desktop.
Python Shift Array Right Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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