I have a dictionary of topics with lists as values.
topics = {'sports':sports, 'food':food, 'movies':movies, 'singers':singers, 'goats':goats}
These are the values
sports = ['soccer','basketball','tennis'],
food = ['burger','fried rice', 'spaghetti','curry', 'lamb','wings']
movies = ['spider man', 'batman', 'iron man', 'hustle', 'desperado']
singers = ['drake']
goats = ['messi', 'jordan']
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:
{'goats':['messi', 'jordan'],
'sports_1', ['soccer','basketball'],
'sports_2': ['tennis'],
'food_1': ['burger','fried rice'],
'food_2': ['spaghetti','curry'],
'food_3': ['lamb','wings'],
'movies_1': ['spider man', 'batman'],
'movies_2: ['iron man', 'hustle'],
'movies_3':['desperado'],
'singers':['drake']}