[Solved] How can I sort these words to make this sentence in Python?


You could try something like this:

dict(sorted(zip(sorrend,sms))).values()

For your shortened example:

>>> sms=['love', 'I', 'much', 'so', 'you']
>>> sorrend=[2,1,5,4,3]
>>> ' '.join(dict(sorted(zip(sorrend,sms))).values())
'I love you so much'

solved How can I sort these words to make this sentence in Python?