Computer Science, asked by Anonymous, 1 month ago

Print the pattern shown in the attachment using python loop.

Attachments:

Answers

Answered by anindyaadhikari13
7

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

The given co‎de is written in Python.

n=3 # Rows = Columns

for i in range(1,n+1):

 for j in range(1,n+1):

   if i==1 or j==1 or i==n or j==n:

     print("* ",end="")

   else:

     print("  ",end="")

 print()

Here, n stores the number of rows for the pattern. Here, I gave four conditions. If any of the conditions is satisfied, star is printed or else, spaces are added. A new line is inserted after that.

Attachments:
Answered by Mbappe007
1

Answer:

The given co‎de is written in Python.

n=3 # Rows = Columns

for i in range(1,n+1):

 for j in range(1,n+1):

   if i==1 or j==1 or i==n or j==n:

 print("* ",end="")

  else

print("  ",end="")

 print()

Here, n stores the number of rows for the pattern. Here, I gave four conditions. If any of the conditions is satisfied, star is printed or else, spaces are added. A new line is inserted after that.

Explanation:

This is not a spam answer and i just asking only a single question . What is the starting incident of our conflict ? Me or You , if me then i will not repeat this again . Then i reported youryesterday when you reported my answers . I reported that answer that you given to me because otherwise my friends will use this chance for destroying my account . In return i will give you a chance for reporting this answer only after reading dont report other answers . Now , problem is solved  .

Similar questions