WeCodeAcademy

Comparing Two Groups

Does a new teaching method beat the old one? The two-sample t-test compares the means of two independent groups and gives a p-value for the null hypothesis "the true means are equal". To compare categories (for example, whether outcome depends on group) use a chi-square test on a table of counts.

Examplepython
Open in editor »
Quick check

What does the chi-square test compare?

Your turn: write the code

Compare the two groups with a two-sample t-test and print the p-value rounded to 4 decimals.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.