N = int(input())
x = list(map(str, (range(1, N+1))))
z = []
z = x.copy()
z = list(reversed(z))
while len(z) > 1:
sp = N - len(z)
print(((" " * sp) * 2) + " ".join(z))
z.pop(len(z)-1)
arr = []
for num in range(N, 0, -1):
sp = " " * ((N * 2) - 2)
arr.insert(0, f"{num}")
print(sp + " ".join(arr))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
N = int(input())
x = list(map(str, (range(1, N+1))))
z = []
z = x.copy()
z = list(reversed(z))
while len(z) > 1:
sp = N - len(z)
print(((" " * sp) * 2) + " ".join(z))
z.pop(len(z)-1)
arr = []
for num in range(N, 0, -1):
sp = " " * ((N * 2) - 2)
arr.insert(0, f"{num}")
print(sp + " ".join(arr))