extension joomla, template joomla,banner extension joomla,jomla slider,slider joomla
Standard Deviation σ

Standard Deviation σ


Standard Deviation

  1. Find out the average value (μ ) of the numbers or the list
  2. Find out the sum (Σ) of square of difference between number and average value
  3. Divide the sum by number of elements ( N )
  4. Take the square root of the above division
We will create a Python function to return the Standard Deviation.
import math  list1=[12,13,15,11,9]  def my_stddev(my_list):      my_sum=0      for i in my_list:          my_sum=my_sum+i      #print(my_sum)        my_no=len(my_list)      my_avg=my_sum/my_no      sum_avg=0      for i in my_list:          sum_avg=sum_avg+math.pow((i-my_avg),2)      std=math.sqrt(sum_avg/my_no)      return std      print(my_stddev(list1))
Output
2.0










Related Article



destination source:https://www.plus2net.com/python/math-standard-deviation.php