题解 | #生成列表#

生成列表

https://www.nowcoder.com/practice/349954d559e1494ba5f83e42388ba8ea

定义接收变量与列表变量,在接收输入的同时,将字符串按照空格进行分割

name = input().split(" ")
name_list = list()

利用for循环将接收到的字符串写入空列表并打印

for i in name:
    name_list.append(i)
print(name_list)
全部评论

相关推荐

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

创作者周榜

更多
牛客网
牛客企业服务