-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbetterSolution.py
More file actions
40 lines (31 loc) · 828 Bytes
/
betterSolution.py
File metadata and controls
40 lines (31 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from __future__ import print_function
from pprint import pprint
number_of_test_cases = int(raw_input())
def number_matrix(matrix):
for row in matrix:
for cell in row:
if cell == "X":
cell = 1
else:
cell = 0
return matrix
for _ in range(number_of_test_cases):
# height of the image
n = int(raw_input())
# width of the image
m = int(raw_input())
pattern = []
for _ in range(n):
line = raw_input()
pattern.append(list(line))
# print("pattern:")
pprint(pattern)
print("")
#pattern = number_matrix(pattern)
#pprint(pattern)
#print("")
for i in range(m):
for j in range(n):
print(pattern[i][j])
if pattern[i][j] == "X":
on_region = True