In this program, we will construct the following star pattern.
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
# first loop iterate from 1 to 6
for i in range(1, 6):
# inner loop iterate from 1 to value of i+1
for j in range(1, i+1):
# print * for each iteration of j
print("*", end=" ")
print()
# this is second section will iterate
# from 5 to 1 in decreasing order
for i in range(5, 1, -1):
for j in range(i, 1, -1):
print("*", end=" ")
print()
Output :
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*