Python Star Pattern 9

Last Updated:

Python Star Pattern 9

Try to print the following star pattern using Python.

Print This Output
    *
   * *
  *   *
 *     *
*       *
 *     *
  *   *
   * *
    *

Source Code

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

Share this Page

Meet the Author