题解 | #单词造句#

单词造句

https://www.nowcoder.com/practice/c0c7fa7523ea4651bd56b6cbc8c65c66

words = [] # 定义一个空列表来存储输入的单词
while True:
    word = input() # 读取一行输入
    if word == "0": # 如果输入为0,则退出循环
        break
    words.append(word) # 将输入的单词添加到列表中
sentence = " ".join(words) # 使用join函数将单词列表拼接成句子
print(sentence) # 输出句子

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务