Python Program for 1-212-32123 Numeric Pyramid Pattern
This python program generates 1-212-32123-4321234 numeric pyramid pattern up to n number of lines.
In this program we first read number of rows from user and set outer loop i for number of lines. Generating 1-212-32123 pattern requires setup for space pattern, decreasing number pattern & increasing number pattern which are set by inner loop j. See program below:
Python Source Code: 1-212-32123 Pattern
# Pattern 1-212-32123...
# Reading number of rows
row = int(input('Enter how many lines? '))
# Generating pattern
for i in range(1,row+1):
# for space
for j in range(1, row+1-i):
print(' ', end='')
# for decreasing pattern
for j in range(i,0,-1):
print(j, end='')
# for increasing pattern
for j in range(2,i+1):
print(j, end='')
# Moving to next line
print()
Python Output: 1-212-32123 Pattern
Enter how many lines? 9 1 212 32123 4321234 543212345 65432123456 7654321234567 876543212345678 98765432123456789