In this article, We will learn find the average of numbers using array in Python. This Program finds the sum and average of specified array elements.
Python Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
arr=[60,80,50,10] sumArr=0 avgArr=0 #csharp-console-examples.com for i in range(0,len(arr)): sumArr+=arr[i] avgArr=sumArr/len(arr) print('The Sum is : ',sumArr) print('The average is : ',avgArr) |
Output: