Normalizing Matrices(Python)
Given N number of matrices, normalize them by diving each number in every matrix by 2.
Input Format
First line: N : Number of matrices
Second line: First 4x5 matrix
Similarly N+1 number of lines (including 1st line)
Constraints
N >= 1
Each input matrix is always 4x5 matrix
Each value in input matrix is < 150 if not print array value out of range for that particular matrix output
if value in input matrix is 0 or 1, write the same number as normalized output i.e. normalized number for 0 is 0 and for 1 is 1.
Output Format
First line is output matrix of first matrix
Similarly for N matrices
Sample Input 0
2
[[4, 4, 4, 4], [2, 2, 2, 2], [6, 6, 6, 6], [8, 8, 8, 8], [8, 8, 8, 8]]
[[31, 91, 80, 11], [50, 11, 20, 10], [22, 33, 11, 11], [10, 12, 33, 23], [8, 8, 8, 8]]
Sample Output 0
[[2, 2, 2, 2], [1, 1, 1, 1], [3, 3, 3, 3], [4, 4, 4, 4], [4, 4, 4, 4]]
[[15, 45, 40, 5], [25, 5, 10, 5], [11, 16, 5, 5], [5, 6, 16, 11], [4, 4, 4, 4]]
Explanation 0
First line is N = 2 i.e. we will be taking 2 matrices as an input Second line is the first matrix Third line is second matrix
We then divide each element in matrix with 2 [[4, 4, 4, 4], [2, 2, 2, 2], [6, 6, 6, 6], [8, 8, 8, 8], [8, 8, 8, 8]] which gives result like this [[2, 2, 2, 2], [1, 1, 1, 1], [3, 3, 3, 3], [4, 4, 4, 4], [4, 4, 4, 4]] Which we print on the first line, similarly for second matrix.
Sample Input 1
1
[[4, 4, 4, 4], [2, 2, 2, 2], [6, 6, 6, 6], [8, 8, 8, 8], [200, 8, 8, 8]]
Sample Output 1
array value out of range
Explanation 1
In 1st Matrix, array value is greater than 150, so we printed array value out of range error for that particular matrix.
question from:
https://stackoverflow.com/questions/65647132/tried-taking-single-char-printing-the-signs-directly-and-diving-the-numbers-wo