Python Tutorial

Python Home

Python Methods

Python String Methods

Python Interview Programs

Python Common ProgramsPython Array ProgramsPython Converter ProgramsPython Star Patterns ProgramPython Number Patterns ProgramPython Alphabet Patterns Program

Python Reference

ASCII Table

Python Number Pattern 54

Last Updated:

Python Number Pattern 54

Try to print the following number pattern using Python.

Print This Output
1       1
 2     2
  3   3
   4 4 
    5
   4 4
  3   3
 2     2
1       1

Source Code

Python Compiler
for i in range(1, 6): for j in range(1, 6): if(i == j): print(i, end="") else: print(" ", end="") for k in range(4, 0, -1): if(i == k): print(i, end="") else: print(" ", end="") print() for i in range(4, 0, -1): for j in range(1, 5): if(i == j): print(i, end="") else: print(" ", end="") for k in range(5, 0, -1): if(i == k): print(i, end="") else: print(" ", end="") print()

Share this Page

Meet the Author