{"id":21455,"date":"2021-09-22T17:36:27","date_gmt":"2021-09-22T12:06:27","guid":{"rendered":"https:\/\/python-programs.com\/?p=21455"},"modified":"2021-11-22T18:36:13","modified_gmt":"2021-11-22T13:06:13","slug":"python-program-to-find-maximum-element-of-each-row-in-a-matrix","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-maximum-element-of-each-row-in-a-matrix\/","title":{"rendered":"Python Program to Find Maximum Element of each Row in a Matrix"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find the Row with Maximum Number of 1s in Matrix<\/a><\/p>\n

Given a matrix, the task is to find the maximum element of each row for the given matrix in python.<\/p>\n

What is a matrix:<\/strong><\/p>\n

A matrix is a rectangular sequence of numbers divided into columns and rows. A matrix element or entry is a number that appears in a matrix.<\/p>\n

Example:<\/strong><\/p>\n

\"\"<\/p>\n

Above is the matrix which contains 5 rows and 4 columns and having elements from 1 to 20.<\/p>\n

In this order, the dimensions of a matrix indicate the number of rows and columns.<\/p>\n

Here as there are 5 rows and 4 columns it is called a 5*4 matrix.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Matrix : \r\n1 5 6\r\n11 5 4\r\n9 34 5<\/pre>\n

Output:<\/strong><\/p>\n

The maximum element of the row { 1 } is : 6\r\nThe maximum element of the row { 2 } is : 11\r\nThe maximum element of the row { 3 } is : 34<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Matrix : \r\n1 6 2\r\n10 14 1\r\n6 9 11<\/pre>\n

Output:<\/strong><\/p>\n

The maximum element of the row { 1 } is : 6\r\nThe maximum element of the row { 2 } is : 14\r\nThe maximum element of the row { 3 } is : 11<\/pre>\n

Program to Find Maximum Element of each Row in a Matrix in Python<\/h2>\n

Below are the ways to find the maximum element of each row for the given matrix in python:<\/p>\n