split list in 3 part

Solutions on MaxInterview for split list in 3 part by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "split list in 3 part"
Luisa
11 Sep 2020
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    ]