Python3 implementation of the approach
N = 4 NEW_LINE print ( " Value ▁ of ▁ N : ▁ " , N ) NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT for j in range ( 1 , N + 1 ) : NEW_LINE INDENT min = i if i < j else j NEW_LINE print ( N - min + 1 , end = " ▁ " ) NEW_LINE DEDENT for j in range ( N - 1 , 0 , - 1 ) : NEW_LINE INDENT min = i if i < j else j NEW_LINE print ( N - min + 1 , end = " ▁ " ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT for i in range ( N - 1 , 0 , - 1 ) : NEW_LINE INDENT for j in range ( 1 , N + 1 ) : NEW_LINE INDENT min = i if i < j else j NEW_LINE print ( N - min + 1 , end = " ▁ " ) NEW_LINE DEDENT for j in range ( N - 1 , 0 , - 1 ) : NEW_LINE INDENT min = i if i < j else j NEW_LINE print ( N - min + 1 , end = " ▁ " ) NEW_LINE DEDENT print ( ) NEW_LINE DEDENT