Python Program Calculate the standard deviation

Python program find standard deviation; In this tutorial, you will learn how to find standard deviation in python with and without inbuilt function.

Python Program Calculate the standard deviation

  • Python program to calculate standard deviation
  • How to find standard deviation in python without inbuilt function

Python program to calculate standard deviation

# import statistics library
import statistics
print(statistics.stdev([40,45,35,10,15,18,12,16], 45))



Note:- stdev() function in python is the Standard statistics Library of Python Programming Language. The use of this function is to calculate the standard deviation of given continuous numeric data.

How to find standard deviation in python without inbuilt function

#define a function, to calculate standard deviation
def stdv(X):
    mean = sum(X)/len(X)
    tot = 0.0
    for x in X:
        tot = tot + (x - mean)**2
    return (tot/len(X))**0.5

# call function with following data set
x = [1, 2, 3, 4, 5, 6, 7, 8] 
print("Standard Deviation is: ", stdv(x))

y = [1, 2, 3, -4, -5, -6, -7, -8] 
print("Standard Deviation is: ", stdv(y))

z = [10, -20, 30, -40, 50, 60, -70, 80] 
print("Standard Deviation is: ", stdv(z))


Standard Deviation is:  2.29128784747792
Standard Deviation is:  4.06201920231798
Standard Deviation is:  48.925964476952316

Recommended Python Programs

  1. Write a Program to Calculate Simple Interest in Python
  2. Python Program to Compute Compound Interest
  3. Leap Year Program in Python
  4. Python Program to Print Star Pattern
  5. Number Pattern Programs in Python
  6. Python Program to Print Even and Odd numbers From 1 to N
  7. Python Abs() Function: For Absolute Value
  8. How to Check Whether a Number is Fibonacci or Not in Python
  9. Python: Program to Find Power of Number
  10. Python Program to Reverse a Numbers
  11. Python Program to Find Smallest/Minimum of n Numbers
  12. Python Program to Find Largest/Maximum of n Numbers
  13. Python Program to Find The Net Bill Amount After Discount
  14. Python Program to Print Numbers From N to 1 and 1 to N
  15. Python Program to Print Numbers Divisible by 3, 5, 7
  16. Python Program to Print Prime Number 1 to N
  17. How to Find Square of Number in Python
  18. Python Program to Calculate Cube of Number
  19. Python Program to Find LCM of Two Numbers
  20. BMI (Body Mass Index) Calculator in Python
  21. Palindrome Program in Python using while loop, Function, etc
  22. Python: Program to Count Total Number of Bits in Number
  23. Python Random Number Generator Code
  24. Python Program to Calculate n-th term of a Fibonacci Series
  25. Zip Zap Zoom Python Program
  26. Python: program to convert Celsius to Fahrenheit
  27. Python Program to Swap Two Numbers
  28. Python Program to Get Standard Deviation
  29. Python Program to Find the Variance
  30. Python Program to Convert Height in cm to Feet and Inches
  31. Python Program to Convert Meters into Yards, Yards into Meters
  32. Python Program to Convert Kilometers to Meters, Miles
  33. Python Program to Find Perfect Number
  34. Python: Program to Find Strong Number
  35. Python Program Create Basic Calculator
  36. Python Program For math.floor() Method
  37. Python Program to Find Sum of Series 1/1! 2/2! 3/3! …1/n!
  38. Python: Program to Convert Decimal to Binary, Octal and Hexadecimal
  39. Python Program to Find Roots of Quadratic Equation
  40. Python Program to Print Alphabets from A to Z in Uppercase and Lowercase
  41. Python Program to Check Given Input is Alphabet, Number or Special Character
  42. Python Program to Check IF a Number is Power of Another Number
  43. Python Check Binary Representation of Given Number is Palindrome or Not
  44. Python Program to Draw a Pie Chart
  45. Python Program Input the Radius of Circle and Compute the Area
  46. Python Program to Calculate the Area of a Rectangle
  47. Python Program to Calculate Area of Triangle
  48. Python Program to Find Area and Circumference of Circle using Radius
  49. Python Program that Accepts Marks in 5 Subjects and Outputs Average Marks
  50. Python Program to Print Binary Value of Numbers From 1 to N


My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *