T 125 - Forming Numericals Python Hacker RAnk

 Print the following pattern :

N = 1
1

N = 2
2 2 2
2 1 2
2 2 2

N = 3

3 3 3 3 3
3 2 2 2 3
3 2 1 2 3
3 2 2 2 3
3 3 3 3 3

and so on.

Input Format

One number N

Constraints

1 <= N <= 10

Output Format

The pattern

Sample Input 0

2

Sample Output 0

2 2 2
2 1 2
2 2 2
Source Code:
def findMax(a,b):
    if a>b:
        return a
    else:
        return b
n=int(input())
for i in range(1,2*n):
    for j in range(1,2*n):
        print(findMax(abs(i-n),abs(j-n))+1,end=' ')
    print()

Comments