Python Program:

- To print X pattern using *

Example:

User Input: 3

Output:

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

Output:

Enter number of rows: 4

*     *
  * * 
  * * 
*     *
Program
pattern

Main Logic :

for i in range(0,rows): #rows : number of rows to print
  for j in range(0,rows):
    if(i==j or j==(rows-i-1)):
      print("* ", end="")
    else:
      print("  ", end="")
  print("")

You can print any thing in this pattern, just replace your value with *

Concept

Coming Soon !

Quick
Tutorial

Quote

Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.