fork download
  1. w, h = 5, 10
  2. matrix = lambda w, h: [[min(x+1, w-x, y+1, h-y) for x in range(w)] for y in range(h)]# your code goes here
  3.  
  4. print(matrix(w, h))
Success #stdin #stdout 0.01s 27664KB
stdin
Standard input is empty
stdout
[[1, 1, 1, 1, 1], [1, 2, 2, 2, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 2, 3, 2, 1], [1, 2, 2, 2, 1], [1, 1, 1, 1, 1]]