Python Program:

- To print full triangle pattern using number

Example:

User Input: 3

Output:

    1
  1 2 1
1 2 3 2 1
rows=int(input("Enter number of rows : "))
for i in range(rows,0,-1):
  k=1
  for j in range(1,2*rows-i+1):
    if(j<i):
      print("  ", end="")
    else:
      if(j<rows):
        print(k, end=" ")
        k+=1
      else:
        print(k, end=" ")
        k-=1
  print("")

Output:

Enter number of rows: 4

      1
    1 2 1
  1 2 3 2 1
1 2 3 4 3 2 1
Program
pattern

Main Logic :

for i in range(rows,0,-1):
  k=1
  for j in range(1,2*rows-i+1):
    if(j<i):
      print("  ", end="")
    else:
      if(j<rows):
        print(k, end=" ")
        k+=1
      else:
        print(k, end=" ")
        k-=1
  print("")
Concept

Coming Soon !

Quick
Tutorial

Quote

We are all now connected by the Internet, like neurons in a giant brain.