Upscaling (Codeforces 1950B)
Tags: Implement, implementation

You are given an integer $$$n$$$. Output a $$$2n \times 2n$$$ checkerboard made of $$$2 \times 2$$$ squares alternating '$$$\texttt{#}$$$' and '$$$\texttt{.}$$$', with the top-left cell being '$$$\texttt{#}$$$'.  The picture above shows the answers for $$$n=1,2,3,4$$$. 

Input: The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 20$$$) — the number of test cases.The only line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 20$$$) — it means you need to output a checkerboard of side length $$$2n$$$.

Output: For each test case, output $$$2n$$$ lines, each containing $$$2n$$$ characters without spaces — the checkerboard, as described in the statement. Do not output empty lines between test cases.


Sample Inputs:
4
1
2
3
4

Sample Outputs:
##
##
##..
##..
..##
..##
##..##
##..##
..##..
..##..
##..##
##..##
##..##..
##..##..
..##..##
..##..##
##..##..
##..##..
..##..##
..##..##

Solution (Python):
for _ in range(int(input())):
    n = int(input())
    for j in range(1, n + 1):
        ans = ''
        if j % 2:
            for i in range(1, n + 1):
                if i % 2:
                    ans += '##'
                else:
                    ans += '..'
            print(ans)
            print(ans)
        else:
            ans = ''
            for i in range(1, n + 1):
                if i % 2:
                    ans += '..'
                else:
                    ans += '##'
            print(ans)
            print(ans)

Solution (Python):
for u in range(int(input())):
    npou = int(input())
    for u in range(npou):
        suga = ''
        for v in range(npou):
            if (u + v) % 2 == 0:
                suga += '##'
            else:
                suga += '..'
        print(suga)
        print(suga)

Solution (Python):
t = int(input())
for i in range(t):
    n = int(input())
    for r in range(n):
        row = ''
        for c in range(n):
            if r % 2 == 0 and c % 2 == 0 or (r + c) % 2 == 0:
                row += '##'
            else:
                row += '..'
        print(row)
        print(row)