wedoca
2/9/2017 - 8:22 PM

script.py

script.py

# coding: utf-8
import console
console.clear()
from matrix import matrix_transpose

def weak_point(m1):
	m2 = matrix_transpose(m1)
	
	row, col = False, False
	for i in range(len(m1)):
		if not row and sum(m1[i]) == sum(min(m1)):
			row = i
		
		if not col and sum(m2[i]) == sum(min(m2)):
			col = i

	return [row, col]

print weak_point([[7, 2, 7, 2, 8],
            			[2, 9, 4, 1, 7],
            			[3, 8, 6, 2, 4],
            			[2, 5, 2, 9, 1],
            			[6, 6, 5, 4, 5]])# == [3, 3]
print ''
print weak_point([[7, 2, 4, 2, 8],
            			[2, 8, 1, 1, 7],
            			[3, 8, 6, 2, 4],
            			[2, 5, 2, 9, 1],
            			[6, 6, 5, 4, 5]])# == [1, 2]