python
Dashboard
My Repos
Compilers
Python Online
Node JS Online
Golang Online
codepy
Login
My Repos
Sign Out
Online Python Interpreter
Stop
Run
import numpy as np from scipy.stats import t pop_mean=float(input("Enter population mean ")) n=int(input("Enter number of data ")) x=list() print("Enter x values ") for i in range (0,n): x.append(float(input())) xbar=np.mean(x) sd=np.std(x) t_stat=abs((xbar-pop_mean)*np.sqrt(n-1)/sd) print("The calculated value of test statistic t is %.4f"%t_stat ) tab_t = t.ppf(0.95,n-1 ) print("The table value of t is %.4f"%tab_t) if (t_stat<tab_t): print("Conclusion: The null hypothesis H0 is accepted") else: print("Conclusion: The alternate hypothesis H1 is accepted")
Share this code with others
Public
Clear
My Repos
Repo
Lang
Login
Register
Login
Create a free account. No Credit card info required.
I agree with the Codepy
Term of Service
Sign Up