import random
# Create a 4x4 list filled with random numbers
rows = 4
cols = 4
matrix = [[random.randint(1, 100) for _ in range(cols)] for _ in range(rows)]
# Find the maximum element and its indices
max_element = matrix[0][0]
max_row = 0
max_col = 0
for i in range(rows):
for j in range(cols):
if matrix[i][j] > max_element:
max_element = matrix[i][j]
max_row = i
max_col = j
# Print the matrix and the indices of the maximum element
print("Matrix:")
for row in matrix:
print(row)
print("\nMaximum element:", max_element)
print("Indices of maximum element: Row =", max_row, ", Column =", max_col)
aW1wb3J0IHJhbmRvbQoKIyBDcmVhdGUgYSA0eDQgbGlzdCBmaWxsZWQgd2l0aCByYW5kb20gbnVtYmVycwpyb3dzID0gNApjb2xzID0gNAptYXRyaXggPSBbW3JhbmRvbS5yYW5kaW50KDEsIDEwMCkgZm9yIF8gaW4gcmFuZ2UoY29scyldIGZvciBfIGluIHJhbmdlKHJvd3MpXQoKIyBGaW5kIHRoZSBtYXhpbXVtIGVsZW1lbnQgYW5kIGl0cyBpbmRpY2VzCm1heF9lbGVtZW50ID0gbWF0cml4WzBdWzBdCm1heF9yb3cgPSAwCm1heF9jb2wgPSAwCgpmb3IgaSBpbiByYW5nZShyb3dzKToKICAgIGZvciBqIGluIHJhbmdlKGNvbHMpOgogICAgICAgIGlmIG1hdHJpeFtpXVtqXSA+IG1heF9lbGVtZW50OgogICAgICAgICAgICBtYXhfZWxlbWVudCA9IG1hdHJpeFtpXVtqXQogICAgICAgICAgICBtYXhfcm93ID0gaQogICAgICAgICAgICBtYXhfY29sID0gagoKIyBQcmludCB0aGUgbWF0cml4IGFuZCB0aGUgaW5kaWNlcyBvZiB0aGUgbWF4aW11bSBlbGVtZW50CnByaW50KCJNYXRyaXg6IikKZm9yIHJvdyBpbiBtYXRyaXg6CiAgICBwcmludChyb3cpCgpwcmludCgiXG5NYXhpbXVtIGVsZW1lbnQ6IiwgbWF4X2VsZW1lbnQpCnByaW50KCJJbmRpY2VzIG9mIG1heGltdW0gZWxlbWVudDogUm93ID0iLCBtYXhfcm93LCAiLCBDb2x1bW4gPSIsIG1heF9jb2wpIA==
Matrix:
[43, 56, 89, 1]
[58, 25, 70, 62]
[92, 5, 19, 74]
[96, 7, 48, 44]
Maximum element: 96
Indices of maximum element: Row = 3 , Column = 0