Build a Sentence
When words are already stored in a list, you often need to join them back into a normal sentence for display. Write a function smash that takes a list words and joins the words with single spaces. If the list is empty, return an empty string.
Примеры
Ввод
["hello", "world", "this", "is", "great"]Вывод
"hello world this is great"Ввод
[]Вывод
""Ввод
["hello"]Вывод
"hello"Нужно реализовать
def smash(words: list[str]) -> str:
Теги
stringslists
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
["hello","world","this","is","great"]Expected
"hello world this is great"2
Input
[]Expected
""3
Input
["hello"]Expected
"hello"4
Input
["Lets","go"]Expected
"Lets go"5
Input
["a","b","c"]Expected
"a b c"6
Input
["A","B","C"]Expected
"A B C"Focus radio
Paused · SomaFM · Fluid