Write a program that prints the second largest value in each row of a given matrix.
Your solution must meet the following conditions:
Write a function
def second_largest_values(m)that receives a matrix of strictly positive integer numbers and returns a list with the second largest value in each row.
write a main program that reads a matrix of integers from the
input, and prints the second largest values in each row. The program
must call the function second_largest_values.
The input is a matrix of strictly positive integers. Each row of the matrix is given in a separate line. All lines have the same amount of elements. Each row contains at least two different values.
The output is the list of the second largest values in each row, in the format shown in the examples.
Input
5 12 23 4 10 7 6 22 9 34 1 112
Output
second largest in row 0 is 12 second largest in row 1 is 10 second largest in row 2 is 34
Input
25 12 23 4 9 10 22 22 1 22 3 3 3 2 2 87 34 1 119 87
Output
second largest in row 0 is 23 second largest in row 1 is 10 second largest in row 2 is 2 second largest in row 3 is 87