Find Sum and Average of List in Python Last Updated : 01 May, 2025 Comments Improve Suggest changes Like Article Like Report Our goal is to find sum and average of List in Python. The simplest way to do is by using a built-in method sum() and len(). For example, list of numbers is, [10, 20, 30, 40, 50] the sum is the total of all these numbers and the average is the sum divided by the number of elements in the list.Using sum() and len()Python provides convenient built-in functions like sum() and len() to quickly calculate the sum and length of list respectively. Python a = [10, 20, 30, 40, 50] sum1 = sum(a) avg = s / len(a) if a else 0 print(sum1) print(avg) OutputSum of the list: 150 Average of the list: 30.0 Explanation:sum(a): Calculates sum of numbers in the list 'a'.len(a): Returns number of elements in the list 'a'.av = sum1 / len(a): This compute the average. We also check if the list is not empty to avoid division by zero.Using LoopIf we'd like to manually calculate the sum and average without using built-in functions then we can find this by looping through the list. Python a = [10, 20, 30, 40, 50] sum1 = 0 l = 0 for val in a: sum1 += val l += 1 avg = sum1 / l if a else 0 print(sum1) print(avg) OutputSum of the list: 150 Average of the list: 30.0 Explanation: We iterate over the list 'a' and calculate their sum and length. And to find the average divide total calculated sum by length of list.Related Articles:sum() function in PythonPython len() Function Comment More infoAdvertise with us Next Article Find Sum and Average of List in Python D deepanshumehra1410 Follow Improve Article Tags : Python Python Programs python-list Python list-programs Practice Tags : pythonpython-list Similar Reads Python - Average digits count in a List Given a list of elements extract the average digit count in List. Input : test_list = [34, 2345, 23, 456, 2, 23, 456787] Output : 2.857142857142857 Explanation : Average of all digit count. [2+4+2+3+1+2+6 = 20, 20/7 = 2.857142857142857] Input : test_list = [34, 1, 456]Output : 2.0 Explanation : Aver 4 min read Python | Average of two lists The problem of finding a average values in a list is quite common. But sometimes this problem can be extended in two lists and hence becomes a modified problem. This article discusses shorthands by which this task can be performed easily. Letâs discuss certain ways in which this problem can be solve 5 min read Python | Average String length in list Sometimes, while working with data, we can have a problem in which we need to gather information of average length of String data in list. This kind of information might be useful in Data Science domain. Let's discuss certain ways in which this task can be performed. Method #1 : Using list comprehen 8 min read Python program to find sum of elements in list Finding the sum of elements in a list means adding all the values together to get a single total. For example, given a list like [10, 20, 30, 40, 50], you might want to calculate the total sum, which is 150. Let's explore these different methods to do this efficiently.Using sum()sum() function is th 3 min read Column Average in Record List - Python Given a list of records where each record contains multiple fields, the task is to compute the average of a specific column. Each record is represented as a dictionary or a list, and the goal is to extract values from the chosen column and calculate their average. Letâs explore different methods to 3 min read Like