generate functionFri, 10 Feb 2023

The input is a natural number n — the number of rows and columns in the square matrix. Next, the elements of the matrix are entered line by line with a space. Output the maximum element excluding the area above the main diagonal.

def max_el_matrix(n): matrix = [] for i in range(n): matrix.append(list(map(int, input().split()))) max_el = -100 for i in range(n): for j in range(n): if i < j: if matrix[i][j] > max_el: max_el = matrix[i][j] return max_el max_el_matrix(4)

Questions about programming?Chat with your personal AI assistant