Mancolo

Untitled

Oct 21st, 2020
579
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def everynth(arr, n):
  2.     ans = [[] for i in range(n)]
  3.     for i in range(len(arr)):
  4.         ans[i % n].append(arr[i])
  5.     return ans
  6.  
  7. print(everynth(['a','b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'], 3))
RAW Paste Data