2
Hello, How do I change the value of a number in a matrix when I don’t know what its index is and there might be more than one value to change? For example, if I have the matrix:
[[4,5,3,15,4],
 [20,17,3,4,56],
 [5,6,2,90,32],
 [18,7,1,8,13],
 [0,20,30,4,7]]
And I want all the values that are smaller or equal 4 to be changed to 10, how do I do? Specifically a repeating structure, as the matrix may have different size depending on the case. I tried to do it this way:
lista  = [[4,5,3,15,4],
          [20,17,3,4,56],
          [5,6,2,90,32],
          [18,7,1,8,13],
          [0,20,30,4,7]]
numero <= 4
if numero in lista:
    lista[lista.index(4)] = 10    
print (lista)
However, the repeating structure does not work... The output should be:
 [[10,5,10,15,10],
  [20,17,10,10,56],
  [5,6,10,90,32],
  [18,7,10,8,13],
  [10,20,30,10,7]]