Write a function col_end_ok_at_iteration_i(grid, i, n, col) that will be called by the assert at the beginning of each iteration of the loop shown above. The purpose of this function is to check the relationship that the last element of the list col should have with the appropriate element of the list-of-lists grid given the values of i and n. You have to figure out what this relationship must be. Your function col_end_ok_at_iteration_i(grid, i, n, col) should return True if this relationship is in fact satisfied given the values of grid, i, n, and col at the point where the assert is made; and False if it is not.def column2list(grid, n): col = [] for i in range(len(grid)): assert col_end_ok_at_iteration_i(grid, i, n, col) col.append(grid[i][n]) return col
[ [ 'aa', 'bb', 'cc', 'dd' ], [ 'ee', 'ff', 'gg', 'hh', 'ii', 'jj' ], [ 'kk', 'll', 'mm', 'nn' ] ]