Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

First:

mean = round(statistics.mean(arr), 2)
median = round(statistics.median(arr), 2)
mode = round(statistics.mode(arr), 2)
std_deviation = round(statistics.pstdev(arr), 2)
variance = round(statistics.pvariance(arr), 2)

q3, q1 = np.percentile(arr, [75, 25])


iqr = round(q3 - q1, 2)

Second:
no_of_perm = 0
no_of_comb = 0

for i in permutations(arr, 2):


no_of_perm += 1

for i in combinations(arr, 2):


no_of_comb += 1

Third:
Just put ans 200

Fourth:
prob = stats.binom.pmf(0, 4, 0.60)
ans = round(1 - prob, 2)

Fifth:
averagepass = 10
prob = stats.poisson.pmf(15, averagepass)
ans= round(prob, 2)

Sixth:
prob_seoul = 0.25
prob_paris = 0.25
prob_dubai = 0.25
prob_switzerland = 0.25

prob_getting_paris_or_seoul = prob_paris + prob_seoul


ans= round(prob_getting_paris_or_seoul, 2)

Seventh:
prob_accident = 0.09
prob_intoxicated = 0.32
prob_accident_and_intoxicated = 0.15

ans = round(prob_accident + prob_intoxicated - prob_accident_and_intoxicated,


2)

last

table=[[18,36,21,9,6],[12,36,45,36,21],[6,9,9,3,3],[3,9,9,6,3]]

stat,p_val,dof,res=chi2_contingency(table)

prob=0.95
critical=chi2.ppf(prob, dof)
if abs(stat) >= critical:
res = 'Reject the Null Hypothesis'
else:
res= 'Failed to reject the Null Hypothesis'

alpha=1.0-prob
if p_val <= alpha:
res = 'Reject the Null Hypothesis'
else:
res = 'Failed to reject the Null Hypothesis'

stat = round(stat,2)
dof = round(dof,2)
p_val = round(p_val,2)

return stat,dof,p_val,res

You might also like