Computer Science, asked by Mister360, 6 hours ago

\Huge{\underline{\sf Question:-}}

Print it

☆☆☆☆☆☆
☆☆☆☆☆
☆☆☆☆
☆☆☆
☆☆



Don't use Internet for answer.

Spam=Strict action will be taken.​

Answers

Answered by anindyaadhikari13
8

\texttt{\textsf{\large{\underline{Solution}:}}}

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.

\texttt{\textsf{\large{\underline{Outp{u}t}:}}}

* * * * * *  

* * * * *  

* * * *  

* * *  

* *  

*

Attachments:
Similar questions