How can I sort a list of sentences like this:
_list = ["i want to buy a car",
"never buy a carpet",
"i need to buy more stuff",
"i don't want to buy it"]
based on a word that precedes / follows a word "buy"?
One way would be to create additional list, store all words that precede / follow the word "buy" and then sort both lists based on a key from a new list. But is there a way to do it without creating additional list?
keyfunction itself.