import scipy.stats as stats mean=float(input("Enter the mean:")) std=float(input("Enter the standard devaiation:")) lower_lim=float(input("Enter the lower limit of normal variate (Enter 0 if -infinity):")) upper_lim=float(input("Enter the upper limit of normal variate (Enter 0 if infinity):")) cdf_upperlim=stats.norm.cdf(upper_lim,loc=mean,scale=std) # We are finding from -infinity to y cdf_lowerlim=stats.norm.cdf(lower_lim,loc=mean,scale=std) # We are finding from -infinity to x prob=cdf_upperlim - cdf_lowerlim z_upper=(upper_lim-mean)/std z_lower=(lower_lim-mean)/std print("z lower limit: ",z_lower) print("z upper limit: ",z_upper) print("Normal probability value: ",prob) import math def normal_prob(mu, sigma, x): return 1/math.sqrt(2*math.pi*math.pow(sigma, 2)) * math.exp(-math.pow(x-mu, 2) / (2 * math.pow(sigma, 2))) mu = 0 # mean sigma = 1 # standard deviation x = 1 # the value to consider result = normal_prob(mu, sigma, x) print("The probability of x =", x, "with mean =", mu, "and standard deviation =", sigma, "is", result)