Gistlib Logo

gistlib

find the average of a data set in python

main.py
def average(data):
    return sum(data) / len(data)

# Example
data = [10, 20, 30, 40, 50]
avg = average(data)
print("Average:", avg)
134 chars
8 lines

similar python code snippets

find the variance of all nodes in a linked list in python
find the standard deviation of all nodes in a linked list in python
find the standard deviation of all values in a map in python
find the average of all values in a map in python
find the variance of all elements in an array in python
find the standard deviation of all keys in a map in python
find the variance of all values in a map in python
find the variance of all keys in a map in python
find the average of all nodes in a linked list in python
find the median of all elements in an array in python

related categories

python
math

gistlibby LogSnag