Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- how_many = input("How many numbers?")
- how_many = int(how_many)
- numbers = []
- total = 0
- sdtotal = 0
- for number_count in range(how_many):
- number = input("Enter number " + str(number_count + 1) + ">")
- numbers.append(number)
- #
- for number_count in range(how_many):
- number = int(numbers[number_count])
- total = total + number
- mean = total/how_many
- print("The mean value is " + str(mean) + ".")
- for number_count in range(how_many):
- number = int(numbers[number_count])
- variance = number - mean
- number = variance * variance
- sdtotal = sdtotal + number
- popsd = sdtotal / how_many
- samplesd = sdtotal / (how_many - 1)
- import math
- popsd = math.sqrt(popsd)
- samplesd = math.sqrt(samplesd)
- print ("The population standard deviation is " + str(popsd) + ".")
- print("The sample standard deviation is " + str(samplesd) + ".")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement