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
Encoding in the information processing theory is the process of _____
Katyanochek1 [597]

Encoding in the information processing theory is the process of inputting of information into the memory system.

<h3>What is encoding?</h3>

Encoding is an act or a system method that is used in the inputting of information into the computer memory system.

It entails the storage in the retention of encoded information. After encoding is the Retrieval method that is the act of getting the information out of memory.

Learn more about encoding from

brainly.com/question/3926211

8 0
2 years ago
Absolute time would be most similar to :
Luda [366]
The absolute time would be most similar to a fact. It was theorised and in fact, approved by scientists as a scientific law which governs, according to Wikipedia, as a "<span>true and mathematical </span>time<span>, of itself, and from its own nature flows equably without regard to anything external, and by another name is called duration: relative, apparent and common </span><span>time."</span>
3 0
4 years ago
This function receives first_name and last_name, then prints a formatted string of "Name: last_name, first_name" if both names a
pishuonlain [190]

Answer:

Following are the program in the C++ Programming Language.

//set header file

#include <iostream>

//set namespace

using namespace std;

//define class

class format

{

//set access modifier

public:

//set string type variable

 string res;

//define function

 void names(string first_name, string last_name)

 {  

//set if-else if condition to check following conditions

   if(first_name.length()>0 && last_name.length()>0)

   {

     res="Name: "+last_name+", "+first_name;

   }

   else if(first_name.length()>0 and last_name.length()==0)

   {

     res="Name: "+first_name;

   }

   else if(first_name.length()==0 and last_name.length()==0)

   {

     res="";

   }

 }

//define function to print result

 void out(){

   cout<<res<<endl;

 }

};

//define main method

int main() {

//set objects of the class

 format ob,ob1,ob2;

//call functions through 1st object

 ob.names("John","Morris");

 ob.out();

//call functions through 2nd object

 ob1.names("Jhon","");

 ob1.out();

//call functions through 3rd object

 ob2.names("", "");

 ob2.out();

}

<u>Output</u>:

Name: Morris, John

Name: Jhon

Explanation:

<u>Following are the description of the program</u>:

  • Define class "format" and inside the class we define two void data type function.
  1. Define void data type function "names()" and pass two string data type arguments in its parameter "first_name" and "last_name" then, set the if-else conditional statement to check that if the variable 'first_name' is greater than 0 and 'last_name' is also greater than 0 then, the string "Name" and the following variables added to the variable "res". Then, set else if to check that if the variable 'first_name' is greater than 0 and 'last_name' is equal to 0 then, the string "Name" and the following variable "first_name" added to the variable "res".
  2. Define void data type function "out()" to print the results of the variable "res".
  • Finally, we define main method to pass values and call that functions.
3 0
3 years ago
The term, botnet, means _____________. a. a program that performs a repetitive task on a network b. spam sent via email to sprea
marshall27 [118]

Answer:

c. a group of compromised computers connected to a network that attacks other networks

Explanation:

<em>Botnets </em>refer to a group of computers controlled from a single source in which software programs are run. Botnets can be used for several purposes, such as scientific (SETI), or computing corporate purposes; on the other hand, botnets are also used for illegal purposes, for instance hacker run malicious programs in order to attack other networks.

4 0
4 years ago
When ____ is pressed after entering an email address or web address, Word automatically formats the address as a hyperlink, that
butalik [34]

Answer:ENTER

Explanation: Hyperlink is the situation that states that the document belongs to some other location. So, if the enter key is pressed by the user after the typing of any email address , then it marks it as the hyperlink which shows it belongs to some other file.

Hyperlink actions also occurs when the user presses space-bar and the web address gets marked by the change in color or by underlined function.

4 0
3 years ago
Other questions:
  • A business wants to centralize its administrative tasks. At the same time, it wants the existing systems to manage and sustain t
    14·2 answers
  • Learning in a digital environment is also called learning.
    6·2 answers
  • Which options are available when a business creates a new theme? Check all that apply.
    12·1 answer
  • 1.Anong uri ng application software ang iyong ginamit upang makapagtutuos ka ng datos?
    15·1 answer
  • If you would like to give another user permissions on your mailbox or to particular folders within your mailbox, which
    7·2 answers
  • Which feature is used to help identify the appropriate content for particular form fields?
    9·1 answer
  • What is the difference between packaged and tailored software ​
    13·1 answer
  • In the code below, what's the final value of the variable x?
    8·1 answer
  • A friend asks you to look over the code for an adventure game and help figure out why it won’t work. Which of these options is s
    5·2 answers
  • How to be gud at Friday night funk
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!