Guest User

Untitled

a guest
May 16th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. hi ed, the program asks the user for how many numbers they want, then the values of each of those numbers, then works out the sum of the number, sum of the numbers sqaured, mean, mean squared,standard diviation and the error in the mean. the program now needs to produce a list or table of the values of x entered by the user, this i cant do. the writing after a # is just read only and is not code. thanks for having a look no worries i you cant help. peace x  
  2. #Stats Coursework
  3. import math
  4. s=0.0
  5. s2=0.0
  6. count=0.0
  7. n=int(raw_input("Please enter how many numbers you like: "))
  8. for count in range (0,n):
  9.     x=float(raw_input("Please enter a value for a number: "))
  10.     s=s+x #sum of the numbers
  11.     s2=s2+x**2.0 #sum of the numbers squared
  12.     mean=s/n #mean
  13.     mean2=s2/n #mean sqaured
  14.     stndev=math.sqrt(mean2-mean**2.0) #standard diviation
  15.     var=stndev/math.sqrt(n) #error in the mean
  16. print "the sum of the numbers are:",s
  17. print "the sum of the square of the numbers are:",s2
  18. print "the sum of the mean of the numbers are:",mean
  19. print "the sum of the Square of the numbers mean is:",mean2
  20. print "the Standard deviation of the numbers are:",stndev
  21. print "the error in the mean is:",var
Add Comment
Please, Sign In to add comment