1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Brilliant_brown [7]
3 years ago
11

How to do row of circles in phyton programming ?

Computers and Technology
1 answer:
Gala2k [10]3 years ago
8 0

Answer:

STEP 1:-

Initialize the number of rows and columns.

for example:-

rows =7

columns=5

 

STEP 2:-

Nest two for loops. outer for loop will iterate rows and inner for loop will iterate columns.

Syntax of nesting two for loops

here i and j are iterators.

for i in range(0,row):

   for j in range(0,col):

STEP 3:-

Now we will use proper condition to print circle

condition 1:- to print ‘*’at first and last column but not at first and last row,

condition2:-to print ‘*’at first and last rows but not at first and last columns.

if the above two conditions are not satisfied then print space (‘ ‘).

code to implement all conditions as follows:-

if((j == 0 or j == columns-1) and (i!=0 and i!=rows-1)) :

    print('*',end='')

elif( ((i==0 or i==row-1) and (j>0 and j<columns-1))):

    print('*',end='')

else:

    print(end=' ')

EXAMPLE

Example to print circle pattern using ‘*’ is as follows

row =6

col=4

for i in range(0,row):

   for j in range(0,col):

       if((j == 0 or j == col-1) and (i!=0 and i!=row-1)) :

           print('*',end='')   #end='' so that print statement should not change the line.

       elif( ((i==0 or i==row-1) and (j>0 and j<col-1))):

           print('*',end='')

       else:

           print(end=' ')  #to print the space.

   print()  #to change the line after iteration of inner loop.

output:-

**  

*  *

*  *

*  *

*  *

**

Explanation:

You might be interested in
Which attitudes are most common among successful IT professionals?
Bess [88]

Answer:

understanding the problem very well

writing documention to every piece of code you write

write clear and concise code

follow Industry accepted format for data storage

avoid recursion if possible

write modular code

5 0
4 years ago
Write down the three part of a computer.<br>​
Nostrana [21]

Answer:

1 system unit 2 monitor 3 keyboard

5 0
3 years ago
Declared inside a function and is only available within the function in which it is declared.
vitfil [10]

Answer:

2b2t

Explanation:

2b2t

3 1
3 years ago
Why did they removed the watch video button to view answers?​
MA_775_DIABLO [31]

Answer:

Umm I’m not sure

Explanation:

7 0
3 years ago
Please someone participate in my typing race ...
dsp73

Answer:

what is typing race

this link can not be clicked

8 0
3 years ago
Other questions:
  • Which is the term for a computer typically located in an area with limited security and loaded with software and data files that
    9·1 answer
  • Is brainly down? Cant search anything
    8·1 answer
  • Which of these should most likely be included in a wire frame ?
    12·1 answer
  • Parts are described by partnum, color, and price. Parts can be subassemblies as well and this means that they contain other part
    12·1 answer
  • Leslie is looking for better job opportunities in his current career path. Which career planning guideline would help him as he
    6·2 answers
  • Which of the following things could you do in order to tell if a pair of colors has strong contrast? A. Look at the colors on th
    12·1 answer
  • Consider a planet where everyone belongs to a family of six, every family lives in its own house, each house has a unique addres
    8·1 answer
  • (e) Give the output of the following:
    15·2 answers
  • PLZ HELP ME!!
    8·2 answers
  • Which of the following is the most accurate definition of a botnet? a small text file passed to a Web browser on a user's comput
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!