I'm trying to return a sentence where the number of words in the sentence is specified by the integer parameter, size. I tried to loop through the keys using
for key in word_positions_dict.keys()
and then got stuck after that.
For example:
my_dict = {'all': [0], 'animals': [1, 6], 'are': [2, 7], 'equal': [3, 9], 'but': [4], 'some': [5], 'more': [8], 'than': [10], 'others': [11]}
print(build_sentence(my_dict, 4))
output should be = all animals are equal