Draw a chessboard which has a height of H cm and a width of W cm. For example, the…
- User
Draw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.
.#.#.#.#. .#.#.#.#.# .#.#.#.#. .#.#.#.#.# .#.#.#.#. .#.#.#.#.#
Note that the top left corner should be drawn by '#'.
Constraints
- 1 ≤ H ≤ 300
- 1 ≤ W ≤ 300 Input
The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space.
The input ends with two 0 (when both H and W are zero).
Output
For each dataset, print the chessboard made of '#' and '.'.
Print a blank line after each dataset.
Example
Input
3 4 5 6 3 3 2 2 1 1 0 0
Output
#.#. .#.# #.#.
#.#.#. .#.#.# #.#.#. .#.#.# #.#.#.
#.# .#. #.#
#. .#
Assistant
while True: line = input().strip() H, W = map(int, line.split()) if H == 0 and W == 0: break for i in range(H): row = [] for j in range(W): if (i + j) % 2 == 0: row.append('#') else: row.append('.') print(''.join(row)) print()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.