Store sum of rowsums , max of row sum number of non zero row sums
for i in range ( r ) : NEW_LINE INDENT row_sum += row [ i ] NEW_LINE row_max = max ( row_max , row [ i ] ) NEW_LINE if ( row [ i ] ) : NEW_LINE INDENT row_non_zero = row_non_zero + 1 NEW_LINE DEDENT DEDENT