Skip to content

Instantly share code, notes, and snippets.

@eyaltrabelsi
Created July 6, 2019 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyaltrabelsi/c9284b15349ec6879fa0ae6e92003734 to your computer and use it in GitHub Desktop.
Save eyaltrabelsi/c9284b15349ec6879fa0ae6e92003734 to your computer and use it in GitHub Desktop.
Python trick k rotation of iterables
>>> a = [1, 2, 3, 4]
>>> k = 2
>>> a[-2:] + a[:-2]
[3, 4, 1, 2]
@JonatanVaara
Copy link

Why k = 2 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment