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 located on the main diagonal and below it

def max_below_diagonal(n): a = [list(map(int, input().split())) for _ in range(n)] return max([a[i][j] for i in range(n) for j in range(i+1, n)]) max_below_diagonal(int(input()))

Questions about programming?Chat with your personal AI assistant