- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find average of a list in python?
Python provides sum function for calculating n number of element. Here we use this function and then calculate average.
Step 1: input “size of the list” Step 2: input “Element” Step 3: using sum function calculate summation of all numbers. Step 4: calculate average.
# Average of a list A=list() n=int(input("Enter the size of the List ::")) print("Enter the number ::") for i in range(int(n)): k=int(input("")) A.append(int(k)) sm=sum(A) avg=sm/n print("SUM = ",sm) print("AVERAGE = ",avg)
Enter the size of the List ::5 Enter the number:: 10 20 30 40 50 SUM = 150 AVERAGE = 30.0
- Find average of a list in Java
- Python – Average digits count in a List
- Average of each n-length consecutive segment in a Python list
- Find size of a list in Python
- Program to count average of all special values for all permutations of a list of items in Python
- Write a Python program to find the average of first row in a Panel
- How to find the average of non-zero values in a Python dictionary?
- Program to find average waiting time in Python
- Find elements of a list by indices in Python
- Find Mean of a List of Numpy Array in Python
- Find same contacts in a list of contacts in Python
- Golang Program to Calculate the Average of Numbers in a Given List
- Program to find maximum average pass ratio in Python
- Find maximum length sub-list in a nested list in Python
- How to find sum a list of numbers in Python?