python break list into n lists

Solutions on MaxInterview for python break list into n lists by the best coders in the world

showing results for - "python break list into n lists"
Greta
12 May 2016
1def even_divide(lst, num_piece=4):
2    return [
3        [lst[i] for i in range(len(lst)) if (i % num_piece) == r]
4        for r in range(num_piece)
5    ]