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
After Maya gave her friend the password to a protected website, the friend was able to remember it only long enough to type it i
EleoNora [17]

Answer:

The correct answer is Short Term Memory.

Explanation:

The A and D options, Procedural and Implicit memory are two of the long-term memory types and the question states that Maya forgot the password after typing it in, so these options are incorrect. Option C, Flashbulb Memory is a type of memory which stores specific moments and events in a person's lifetime which are remembered like snapshots. So the correct answer is B, Short Term Memory. I hope this answer helps.

5 0
3 years ago
______ includes websites that encourage interaction and connection among people, businesses, and organizations.
Sav [38]
Social Media is right I think. 
4 0
3 years ago
Read 2 more answers
​Lara is the chief editor of "Laughter and Life," an online magazine. Lara has assigned Jenny the task of redesigning the magazi
Zarrin [17]

Answer:

The "A" option is correct.

Explanation:

For CSS flexbox layout, the property "align-content" requires that the space in the flexbox is more than enough to show the items. In this case, to distribute evenly the items and show the first and last items aligned with the start and end of the main axis, the only suitable option is "space-between". This option leaves no space at the start or at the end of the flexbox, distributing the remaining space between the elements into the flexbox.

7 0
3 years ago
Given a integer, convert to String, using String Builder class. No error checking needed on input integer, However do read in th
Gennadij [26K]

Answer:

The program in Java will be:

// Java program to demonstrate working parseInt()  

public class GFG  

{  

   public static void main(String args[])  

   {  

       int decimalExample = Integer.parseInt("20");  

       int signedPositiveExample = Integer.parseInt("+20");  

       int signedNegativeExample = Integer.parseInt("-20");  

       int radixExample = Integer.parseInt("20",16);  

       int stringExample = Integer.parseInt("geeks",29);  

 

       // Uncomment the following code to check  

       // NumberFormatException  

 

       //   String invalidArguments = "";  

       //   int emptyString = Integer.parseInt(invalidArguments);  

       //   int outOfRangeOfInteger = Integer.parseInt("geeksforgeeks",29);  

       //   int domainOfNumberSystem = Integer.parseInt("geeks",28);  

 

       System.out.println(decimalExample);  

       System.out.println(signedPositiveExample);  

       System.out.println(signedNegativeExample);  

       System.out.println(radixExample);  

       System.out.println(stringExample);  

   }  

}

7 0
3 years ago
write a pseudo code and flow chart that take a number as input and prints multiplication table up to 10
Troyanec [42]

PSEUDOCODE:

1. DECLARE number: INTEGER

2. DECLARE multiple: INTEGER

3. INPUT number  

4. FOR counter FROM 1 TO 10 DO

5.     multiple <-- number * counter

6.     PRINT number, " * ", counter, " = ", multiple

7. ENDFOR


<em>1. declaring a variable "number" as an Integer</em>

<em>2. declaring a variable "multiple" as an Integer</em>

<em>3. The user inputs the value of number</em>

<em>4. FOR loop where variable "counter" increments by 1 after every iteration</em>

<em>5. sets the value for variable "multiple" as the value of number * counter</em>

<em>6. prints out for example "3 * 1 = 3" and will continue till counter reaches 10</em>

<em>7. Ends the for loop</em>

FLOWCHART below

hope it helped

8 0
3 years ago
Other questions:
  • Which of the following attributes of a website indicates a more reliable source for information?
    8·1 answer
  • Declare an array named tax rates of five elements of type double and initialize the elements (starting with the first) to the va
    12·1 answer
  • There is usually a positive side and a negative side to each technology improvement. Select a technology you use every day and c
    5·1 answer
  • Grace is performing a penetration test against a client's network and would like to use a tool to assist in automatically execut
    13·2 answers
  • Which printer are used to print text and graphics with high speed ​
    15·1 answer
  • Assume there are two variables, k and m, each already associated with a positive integer value and further assume that k's value
    13·1 answer
  • Why would over-50 executives have a harder time buying into the idea of social media?​
    15·1 answer
  • Why is my speedtest is very good but chrome is slow
    11·1 answer
  • Catherine, a web designer, has created new content for a client's website. In order to update the company website, she needs to
    15·1 answer
  • CODEHS: WHY is it important to know the difference between div and span?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!