Question:
I have a dictionary of topics with lists as values.
These are the values
I want to transform the dictionary in a manner that, given size k, the elements in the list shouldn’t be greater than k. If they are, create a new list, and put the elements in. For instance, if
k = 2
, that means I want the list values to be split like this:
Answer:
Try:
Prints:
If you have better answer, please add a comment about this, thank you!