python slice a list a specific amount of times

Solutions on MaxInterview for python slice a list a specific amount of times by the best coders in the world

showing results for - "python slice a list a specific amount of times"
Ivanna
12 Aug 2018
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    ]