All problems
Chi Square Table Degrees of Freedom
Problem
The degrees of freedom for a contingency table chi-square test of independence is (rows - 1)(columns - 1).
Given the number of rows and columns, return the degrees of freedom.
Hint
One degree is lost for each margin.
Test cases
case 1
in: [2,2]
expected: 1
case 2
in: [3,4]
expected: 6
case 3
in: [5,2]
expected: 4
Starter codePython
def chi_square_table_degrees_of_freedom(rows, cols):
# Your code here
pass3 test cases · run your code against them in the editor