T-Statistic for Two Group Means
Same Northbank pilots, one step further. Each pilot reports two cohorts: a size, an average mark and a sample standard deviation for the draft-A group, and the same three for the draft-B group. The course lead now wants each pilot's gap restated on the scale you just worked out, so it can be checked against a table instead of against intuition.
Task: Print the two-sample test statistic for the difference between the cohort means, rounded to 2 decimals. The conventions: independent samples, not paired; equal population variances assumed, so the pooled, equal-variance t-statistic rather than Welch's; the reported spreads are sample standard deviations; the difference is taken as cohort A minus cohort B, so A scoring higher gives a positive statistic; and rounding happens once, on the final value.
Input
Six lines: cohort A's size, average mark and sample standard deviation, then cohort B's size, average mark and sample standard deviation, in that order. The sizes are whole numbers of at least 2; the spreads are positive decimals.
Output
One line holding the t-statistic, rounded to 2 decimals and printed the way Python prints a float - 1.62, and negative when cohort B scored higher.
Example:
Input:
10
82
5
10
78
6
Output:
1.62
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in