📜  在 python 中使用输入添加数组 - Python 代码示例

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

代码示例1
#Python program to add all the array elements using the built-in function
lst = []
num = int(input("Enter the size of the array: "))
print("Enter array elements: ")
for n in range(num):
  numbers = int(input())
  lst.append(numbers)
print("Sum:", sum(lst))