
Print it
☆☆☆☆☆☆
☆☆☆☆☆
☆☆☆☆
☆☆☆
☆☆
☆
Don't use Internet for answer.
Spam=Strict action will be taken.
Answers
Answered by
8
1. Using nested loop.
for i in range(6,0,-1):
for j in range(i):
print('*',end=' ')
print()
2. Using 1 loop.
for i in range(6,0,-1):
print('* '*i)
3. One-liner.
print('\n'.join('* '*i for i in range(6,0,-1)))
Patterns are solved using nested loops. We can also write one-liner for a pattern by combining all the statements.
* * * * * *
* * * * *
* * * *
* * *
* *
*
Attachments:



Similar questions