Realization method of finding the sum and average value of an array with python
- 2021-07-06 11:12:16
- OfStack
As shown below:
# coding = GBK
a =[1,2,3,4,5]
sum=0
b = len(a)
print(" The length of this array is: ",b)
for i in a:
sum =sum +i
print(" The sum of these arrays is: ",sum)
print(" The average number of this array is ",sum/b)