Python Program to find sum of array elements using sum function

Program

number_array = list()
size = int(input("Enter the size of array:\t"))
print("Enter the numbers in array: ")
for i in range(int(size)):
    n = input()
    number_array.append(int(n))
total = sum(int(i) for i in number_array)
print("Sum of array is:\t", total)

Output

$ python3 sum_of_array_elements.py
Enter the size of array:        6
Enter the numbers in array:
1
3
5
6
8
0
Sum of array is:         23