Construct a Pattern using Nested Loop

Write a Python program to construct the following pattern, using a nested loop

 

# Define the number of rows for the diamond

num_rows = 5

# Create the diamond pattern

for i in range(1, num_rows + 1):

    print(" " * (num_rows - i) + "* " * i)

for i in range(num_rows - 1, 0, -1):

    print(" " * (num_rows - i) + "* " * i)

 

OUTPUT