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 matrix(): n = int(input()) a = [] for i in range(n): a.append([int(s) for s in input().split()]) res = -100 for i in range(n): for j in range(n): if i > j and a[i][j] > res: res = a[i][j] print(res) matrix()

Questions about programming?Chat with your personal AI assistant