You will write functions that find a pass rate, an overall rate, and whether a table shows Simpson's paradox. The checker uses the tutoring centre of the lesson.
The idea. A table is a dictionary: for each method, a dictionary of groups, each with (passed, total). The paradox happens when one method wins in every group but loses overall.
Your tasks.
rate(passed, total). Return a percentage.overall(groups). Add the passes and the totals of all groups first.is_paradox(table, first, second). Return True when first beats second in every group but not overall.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…