Answers for "1 121 12321 triangle in python"

0

1 121 12321 triangle in python

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 increasing pattern
    for j in range(1,i+1):
        print(j, end='')
    
    # for decreasing pattern 
    for j in range(i-1,0,-1):
        print(j, end='')
    
    # Moving to next line
    print()
Posted by: Guest on July-31-2020

Python Answers by Framework

Browse Popular Code Answers by Language