We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Math
- Triangle Quest 2
- Discussions
Triangle Quest 2
Triangle Quest 2
Sort by
recency
|
1174 Discussions
|
Please Login in order to post a comment
n = int(input()) pyramid = []
for i in range(1, n + 1): # build ascending and descending numbers line = list(range(1, i + 1)) + list(range(i - 1, 0, -1)) pyramid.append(''.join(map(str, line))) # we convert numbers to strings here once
single print statement
print(*pyramid, sep='\n')
n = int(input()) pyramid = []
for i in range(1, n + 1): # build ascending and descending numbers line = list(range(1, i + 1)) + list(range(i - 1, 0, -1)) pyramid.append(''.join(map(str, line))) # we convert numbers to strings here once
single print statement
print(*pyramid, sep='\n')
For Python3 Platform
n = int(input()) for i in range(1, n+1): print((10**i // 9)**2)
n = int(input()) for i in range(1, n+1): print(int("1" * i) ** 2)