📌  相关文章
📜  如何在 python 代码示例中的列表中获取用户输入

📅  最后修改于: 2022-03-11 14:46:01.989000             🧑  作者: Mango

代码示例3
# Create an empty list
Elements = list()

# Iterating till the range of elements that has to be input
for i in range(0, int(input("Enter the number of elements: "))):
    Elements.append(input("Enter the " + str(i + 1) + " input: ")) # Adding the element to the list 

#Printing the list
print(Elements)