python如何将几个数字或者字符输入到一个列表或者字符串中在一行输出

2025-04-16 16:52:21
推荐回答(1个)
回答1:

以下代码调试通过:

l = []

for i in range(5):
    n = input("please enter the number:")
    l.append(n)

print('l:', l)

运行效果:

please enter the number:12
please enter the number:34
please enter the number:56
please enter the number:35
please enter the number:22
l: ['12', '34', '56', '35', '22']

Process finished with exit code 0