from random import random row = 5 col = 10 matrix = [] for i in range(row): myrow = [] for j in range(col): myrow.append(int(random()*50)+10) matrix.append(myrow) for myrow in matrix: print(myrow) num = int(input("Range of numbers(10-50): ")) print("Rows: ", end=' ') for i in range(row): if num in matrix[i]: print(i,end=' ') print() print("Columns: ",end=' ') for j in range(col): for i in range(row): if matrix[i][j] == num: print(j, end=' ') break print() |

Output:

[24, 52, 20, 43, 37, 58, 48, 24, 17, 51]
[10, 42, 51, 10, 41, 27, 41, 18, 55, 51] |