Last active
May 1, 2017 02:48
-
-
Save chand1012/34d6fefb03b1136a769489f236192c61 to your computer and use it in GitHub Desktop.
confidence calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sqrt | |
print("Calculating confidence of 95%") | |
avg = float(input("Enter average of the data:")) | |
n = int(input("Enter number of items:")) | |
sd = float(input("Enter standard devation:")) | |
z = 1.96 | |
conf_high = avg + z * (sd/sqrt(n)) | |
conf_low = avg - z * (sd/sqrt(n)) | |
st_err = (sd/sqrt(n)) | |
print("Confidence high: {}".format(conf_high)) | |
print("Confidence low: {}".format(conf_low)) | |
print("Standard Error of the mean: {}".format(st_err)) | |
print("With 95 percent confidence we have determined that the\nmean of the data is between\n{} and {}".format(conf_low, conf_high)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Execute this program online here.