fork(1) download
  1. import numpy as np
  2.  
  3. lista = [[4,5,3,15,4],
  4. [20,17,3,4,56],
  5. [5,6,2,90,32],
  6. [18,7,1,8,13],
  7. [0,20,30,4,7]]
  8.  
  9. arr = np.asarray(lista)
  10. np.place(arr, arr<=4, [10])
  11.  
  12. print(arr)
Success #stdin #stdout 0.14s 24792KB
stdin
Standard input is empty
stdout
[[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]]