Created
February 17, 2023 09:18
-
-
Save retraigo/1a043d3e3d30a0fbd861f2aa059a9fee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
size = (2 * n) - 1 | |
d = [] | |
for i in range(n - 1): | |
s = [] | |
for j in range(n - 1): | |
s.append(str(n - min(i, j))) | |
rev = [x for x in s] | |
rev.reverse() | |
s.append(str(n - i)) | |
s.extend(rev) | |
d.append("".join(s)) | |
ns = "" | |
for i in range(1, size + 1): | |
ns += str(abs(n - i) + 1) | |
if n <= 1: | |
print(ns) | |
else: | |
print("\n".join(d), ns, "\n".join(d[::-1]), sep="\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment