【发布时间】:2021-02-27 20:55:28
【问题描述】:
用户想要输入如下数据并将 N 保存为整数列表,将 B 保存为字符串列表。
输入:
2
hello world
3
how are you
5
what are you doing man
然后我想像下面这样保存这两个列表:
N=[2,3,5]
B=['hello world','how are you','what are you doing man']
我从下面的代码开始,但我不确定如何将其放入循环中以保存所有代码。
N=list(map(int, input()))
B = list(map(str, input().split()))
【问题讨论】:
标签: python string list for-loop user-input