Untitled

Run Settings
LanguagePython
Language Version
Run Command
col, row = map(int, input().split()) matrix = [] for a in range(row): matrix.append(list(input())) for b in range(col): if matrix[a][b] == '*': continue else: matrix[a][b] = 0 for i in range(row): for j in range(col): for y in range(i - 1, i + 2): for x in range(j - 1, j + 2): if y < 0 or x < 0 or y >= row or x >= col: continue elif matrix[y][x] == '*': if matrix[i][j] == '*': continue matrix[i][j] += 1 for q,w,e,r,t in matrix: print(q,w,e,r,t)
Editor Settings
Theme
Key bindings
Full width
Lines