RULES :
- In the outer loop , count the no of lines
- For the inner loop , focus on columns & connect them somehow to the rows
- Print them “*” middle of the inner loop
- Observe Symmetry
PATTERN -1:
'''
******
******
******
******
'''
# outer loop -> 4 times (since it has 4 lines)
for i in range(5):
# inner loop -> 7 columns (7 times print * in the same line)
for j in range(7):
print('*', end=" ")
print( )
PATTERN -2:
'''
*
**
***
****
*****
'''
def nForest(n:int) ->None:
# n rows
for i in range(n):
# for each row -> (no of cols = row_num )
for j in range(i+1):
print('*',end=' ')
print()
PATTERN -3:
'''
****
***
**
*
'''
def seeding(n: int) -> None:
# n rows
for i in range(n):
# connect cols with row
for j in range(n-i):
print('*',end=' ')
print()
PATTERN - 4:
'''
*
***
*****
'''
code :
num_rows = 4
for i in range(0, num_rows):
for j in range(0, num_rows-i-1):
print(end=" ")
for j in range(0, i+1):
print("*", end=" ")
print()