9 AnswersNew Answer
hmmmm here is my idea. It sorts the words by that char, which is in a set of the numbers. makes the story a bit shorter. nice challenge by the way. https://code.sololearn.com/c8Ybj6E3x2sR/?ref=app
print(' '.join(sorted(s.split(), key=sorted))) https://code.sololearn.com/cC01C3XizgIu/?ref=app
《 Nicko12 》 , Frogged , RKK ,Vitaly Sokol , all of you with brilliant ideas and a great code. 👍👍👍👍 and BTW a real nice challenge!
First, the reason why the if-elif-else statements wont work is because even though the list is still empty, the program will still insert an element to N index. We insert 3 so the list will now look like this:  Next elements = 7, 1, 6, 4, 5: [3, 7] [1, 3, 7] [1, 3, 7, 6] #Since 6 means insert to 5th index it will append instead of inserting between 4 and 7. [1, 3, 7, 4, 6] #Then the 4 will insert to 3rd index. And the sequence will insert randomly and so on... - - - - - - - -- - - - - - - - - - - - So I thought of doing and sorting this using Dictionary. (see the code for further explanation) https://code.sololearn.com/cA61a1A9A0a1
lil' hack added to your solution Franc. https://code.sololearn.com/cRZ9L6nRijcj/?ref=app
I added te1n0 and e1even1 to make it more interesting. https://code.sololearn.com/c76y9DOuisbF/?ref=app
Louis , great code 👍👍👍👍
https://code.sololearn.com/cPGt0mLmmUO5/?ref=app Francisco Javier see this !
See this Francisco Javier https://code.sololearn.com/cdGAVLNwuxnN/?ref=app taking in account also no numbers and multiple numbers in each word, not only 1...9