Below is my code:
import heapq
sentences_scores = {'Fruit': 6, 'Apple': 5, 'Vegetables': 3, 'Cabbage': 9, 'Banana': 1}
summary = heapq.nlargest(3, sentences_scores, key = sentences_scores.get)
text = ""
for sentence in summary:
text = text + sentence + ' '
print(text)
I get the output:
Cabbage Fruit Apple
But i want to get the output:
Fruit Apple Cabbage
How can i do that?