【发布时间】:2022-12-31 20:16:47
【问题描述】:
a = input("Name of 1st Fruit: ")
b = input("Name of 2nd Fruit: ")
c = input("Name of 3rd Fruit: ")
d = input("Name of 4th Fruit: ")
e = input("Name of 5th Fruit: ")
f = input("Name of 6th Fruit: ")
l = (a,b,c,d,e,f)
print(l)
编写一个程序,将七个水果存储在用户输入的列表中... 这里我们使用输入函数来输入七个水果的名称,我们必须将这些名称存储在一个列表中。 在那之后,我们必须做什么?
【问题讨论】:
-
您将它们存储在元组中,而不是列表中。
-
您可以使用循环将每个添加到列表中,不要创建 7 个变量
标签: python coding-style python-3.10