# Python – Mean deviation of Elements

PythonServer Side ProgrammingProgramming

When it is required to find the mean deviation of the elements of a list, the ‘sum’ method and the ‘len’ method is used.

## Example

Below is a demonstration of the same

my_list = [3, 5, 7, 10, 12]

print("The list is :")
print(my_list)

my_mean = sum(my_list) / len(my_list)
my_variance = sum([((x – my_mean) ** 2) for x in my_list]) / len(my_list)
my_result = my_variance ** 0.5

print("The result is :")
print(result)

## Output

The original list :
[3, 5, 7, 10, 12]
the standard deviation of list is :
3.2619012860600183

## Explanation

• A list is defined and is displayed on the console.

• The ‘sum’ of the list and the ‘len’ of the list is obtained.

• The ‘sum’ is divided by the ‘len’.

• This is assigned to a variable.

• Now, the elements in the list are iterated and squared.

• Their sum is obtained and assigned to another variable.

• The square root of the above variable is obtained and assigned to a ‘result’.

• This is the output that is displayed on the console.