In a list with range(1,16) and I am trying to divide this list in some fixed numbe n . Let's assume n=7
>>> y
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,]
>>> k = [ y [o:p + 7] for o in range(0, len(y), 7) ]
>>> k
[[1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14], [15]]
Now I want to split this list in such a manner that I get n chunks even/uneven, How can I do that?
If you are looking for upskilling yourself in python you can join our Python Certification and learn from an industry expert.