# Python Program to print Maximum, Minimum and sum of Matrix

## Maximum, Minimum and sum of Matrix

Write a program to print the maximum, minimum and sum of all elements in the matrix.

Input

The first line of input will contain two space-separated integers, denoting the M and N.
The next M following lines will contain N space-separated integers, denoting the elements of each list.

Output

The first line of output should be the maximum of all elements in the matrix.
The second line of output should be the minimum of all elements in the matrix.
The third line of output should be the sum of all elements in the matrix.

Explanation

For example, if the given M is 3 and N is 3, read the inputs in the next three lines. If the numbers given in the next three lines are the following.

1 2 3
10 20 30
5 10 15

The first line of output should print the maximum of all the elements in the matrix, which is 30.
The second line of output should print the minimum of all the elements in the matrix, which is 1
The third line of output should print the sum of all the elements in the matrix, which is 96.

So the output should be

30
1
96

Sample Input 1
3 3
1 2 3
10 20 30
5 10 15

Sample Output 1
30
1
96

Code:

``````def convert_string_to_int(list_a):
new_list = []
for item in list_a:
num = int(item)
new_list.append(num)
return new_list

m, n = input().split()
m, n = int(m), int(n)
num_list = []

for i in range(m):
list_a = input().split()
list_a = convert_string_to_int(list_a)
num_list.append(list_a)

row_max = []
row_min = []
row_sum = []
for row in num_list:
row_max.append(max(row))
row_min.append(min(row))
row_sum.append(sum(row))
print(max(row_max))
print(min(row_min))
print(sum(row_sum))``````

Input
2 5
-50 20 3 25 -20
88 17 38 72 -10

Output
88
-50
183

## Python Program to Convert Integer into a Single Numeral

Single Digit Number Ram is given a positive integer N .He wishes to convert this integer into a single numeral. He does so by repeatedly adding the…

## Python Program to Print Armstrong numbers between two intervals￼

Write a program to print all the Armstrong numbers in the given range A to B (including A and B). An N – digit number is an…

## Python Program to Check if Given Input is a Letter, Digit or Special Character￼

Letter, Digit or Special Character You are given a character as input. Check if the given input is a Lowercase Letter or Uppercase Letter or Digit or…

## Interleave Strings | Python Program to merge two strings by adding characters in alternating order

Interleave Strings Given two strings, write a program to merge the given two strings by adding characters in alternating order, starting with the first string. If a…

## Python Program to Check if given colors are present in the color palate

Shekhar is an artist. He likes to draw and paint. He is now drawing a portrait of a city road which is in the black color and…

## Python Program to Check the eligibility criteria for donor

Python Comparison Operators An XYZ hospital has organised a blood donation camp. The eligibility criteria for donor was as follows  1) Age>=18  2) Weight >=50 kg  3)…