De opdracht laden…
Imagine a sentence where the words were shuffled, but each word still has a number showing its real position. Write a function sort_sentence that receives a string where every word ends with a number from 1 to 9. Sort the words by those numbers, remove the numbers, and return the original sentence.
"is2 sentence4 This1 a3""This is a sentence""Myself2 Me1 I4 and3""Me Myself and I""word1""word"def sort_sentence(s: str) -> str:
Log in om je inzendingsgeschiedenis te zien
InloggenLog in om de AI-mentor te gebruiken
Inloggen"is2 sentence4 This1 a3""This is a sentence""Myself2 Me1 I4 and3""Me Myself and I""word1""word""a1 b2 c3""a b c""second2 first1""first second""x3 y1 z2""y z x"