4.
Write a python program to construct the following pattern, using a nested for
loop.
# *
# * *
# * *
*
# * *
* *
# * *
* * *
# * *
* *
# * *
*
# * *
# *
# Solution:n = 5for i in range(n): for j in range(i): print('*', end="") print('') for i in range(n,0,-1): for j in range(i): print('*', end="") print('')
No comments:
Post a Comment