Run ❯
Get your
own Python
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
import scipy.stats as stats import math # Specify the number of occurences (x), the sample size (n), and the proportion claimed in the null-hypothesis (p) x = 10 n = 40 p = 0.2 # Calculate the sample proportion p_hat = x/n # Calculate and print the test statistic print((p_hat-p)/(math.sqrt((p*(1-p))/(n))))
0.7905694150420945