Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sum_square_rows_and_columns(square, searched_sum):
- n = len(square)
- m = len(square[0])
- for index_row in range(0,n):
- rows_sum = 0
- columns_sum = 0
- for index_column in range(0,m):
- row_element = square[index_row][index_column]
- column_element = square[index_column][index_row]
- rows_sum += row_element
- columns_sum += column_element
- if rows_sum != searched_sum and columns_sum != searched_sum:
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement