Python program to print the diamond pattern using for loop

Python program to print the diamond pattern using for loop. The Python programming language is used to build a diamond pattern program. The diamond pattern will be printed in the production of this program. In Python, a diamond pattern program with an asterisk and a lines range is used to print the number of lines output.

lines = 5
k = 2 * lines - 2
for i in range(0, lines):
for j in range(0, k):
print(end=" ")
k = k - 1
for j in range(0, i + 1):
print("* ", end="")
print("")
k = lines - 2
for i in range(lines, -1, -1):
for j in range(k, 0, -1):
print(end=" ")
k = k + 1
for j in range(0, i + 1):
print("* ", end="")
print("")
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *