001Sentence Smash(8kyu)from codewars

发布时间 2023-10-26 13:51:18作者: jiayusu

Sentence Smash(8kyu)

Write a function that takes an array of words and smashes them together into a sentence and returns the sentence.You can ignore any need to sanitize words or add punctuation,but you should adds spaces between each word.Be careful,there shouldn't be a space at the beginning or the end of the sentence!
定义一个函数,导入一组单词,把它们拼凑成一句话,返回这句话。你不用改正单词或增添标点符号,但在每个单词之间应该加上空格。注意,在这句话的开头或结尾不能有空格。

def smash(words):
    return ' '.join(words)

str.join(sequence)
将序列(sequence)(元组、字典、列表、字符串)中的
元素(字符串)
以指定的字符串(str)连接
生成一个新的字符串(返回值)