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
Nimfa-mama [501]
3 years ago
9

Will the Python code below print something? And will it terminate?

Computers and Technology
1 answer:
77julia77 [94]3 years ago
3 0

Answer:

Yes and Yes

Explanation:

When programs are written without indentation; it becomes a problem to read;

I'll rewrite your program as follows:

<em>def print_n(s, n):  </em>

<em>    if n > 0:  </em>

<em>        print(s)  </em>

<em>        print_n(s, n-1)  </em>

<em>    return n  </em>

<em>n = 3  </em>

<em>while print_n("hi", n):  </em>

<em>    print_n("there!", n)  </em>

<em>    n = 0</em>

<em />

Using the above as a point of reference,

Yes, the program will run and Yes, it'll terminate;

Because n is initialized to 3 at line 6 (where the main starts);

The following is passed to the function; s = "hi" and n=3

This prints "hi", three times

s = "there" and n=3 is then passed to the function print_n, afterwards;

The function then prints "there" three times

Then, the program terminates

You might be interested in
A fast way to add up a column of numbers is to click in the cell below the numbers and then: Click Subtotals on the Data menu. V
Art [367]

Answer:

Click the AutoSum button on the Standard toolbar, then press ENTER

Explanation:

Excel offers a range of options to perform various mathematical operations. When numeric values are being inputted into cells, either columns or rows, the AutoSum function which is located in the home Taskbar allows for a very fast addition of the total values in the column or rows. Once the cell after the last cell value is selected, the AutoSum function is selected and the ENTER button is pressed, this will use the sum function of excel to quickly provide the total sum of all the values in the column.

3 0
3 years ago
Read 2 more answers
Draw the hierarchy chart and then plan the logic for a program that calculates a person’s body mass index (BMI).
dusya [7]

Explanation:

I have attached the answer as an image. I can't upload the file as it requires a licensed product and I only used demo version. I can provide the file too if you can give me your vlsig file required to use full software. However, If you just copy along the images on your Visual Studio, you will easily create the files yourself. Answer is provided for both scenarios as part A and part B, one which stops after 1 iteration and the one which loops until 0 height is given.

8 0
2 years ago
Which feature of a blog allows an author to interact and get feedback from his or her readers? link pingback commenting TweetMem
poizon [28]
Commenting. When someone comments of a blog the blog's writer can comment back, to answer questions, etc.
6 0
2 years ago
AirPods se están despintando al ponerlos en quitaesmalte ayudaaaa?
slega [8]

Answer:

In reality, a diluted type of acetone that dissolves plastics and coating is Nail polish removers.

Explanation:

The chemical composition of the material has permanently changed, nothing else than if you had shot it. No repair but replacement is available.

Acetone does not get along with plastics.

This classic timelapse video shows just how cheap plastic acetone is.

When it's out, I have my new AirPods Pro. I got a odd smell when I opened the box when I received it. The little one is solid and chemical. It's new, I guess, and after days it will be gone.

But after ten days of use it doesn't. And the smell remains strong. It won't go quickly, I believe.

Instead I noticed that the smell is often shaping the silicone tips.

About 8 hours a day I use this AirPods Pro. Is it possible for a long time to use this smelling tip?

Actually, I must say they are soft and work well for noise cancelation, I love this silicone tip. If the strange smell doesn't hurt. To me, that's good.

6 0
3 years ago
Which two features could be added to a game using an "if () then" block?
xxTIMURxx [149]

The two features that could be added to a game using an "if () then" block are c. if the player touches a wall, it turns around and moves back 5 and d.

<h3>What does the If Then block mean?</h3>

The If-Then block is understood to be the output certainly considered one among given values, this is because of the fee of a Boolean enter.

Note that the entry fee could be very essential and as such, The functions will be introduced to a sport the use of an "if () then " block are: Using nested If-Then blocks. • Checks the particular Bid amount for the instrument.

Learn greater approximately game from :

brainly.com/question/1786465

#SPJ1

3 0
1 year ago
Other questions:
  • Ask the user to enter a number n &gt;= 1. There after the user will enter n-1 distinct integers between 1 and n. Thus, the enter
    9·1 answer
  • How might writing an online journal be different than writing in a paper one ​
    15·2 answers
  • What were the goals of the “paperless society” ideal?
    14·2 answers
  • What is a strictly layered pattern, provide an example of its usage.
    13·1 answer
  • Which technology concept uses computer resources from multiple locations to solve a common problem?
    11·2 answers
  • A ________ is a powerful analytical tool to size up Apple Inc.'s competitive assets in order to determine whether or not those a
    9·1 answer
  • An end-user license agreement protects _____.
    7·1 answer
  • Cómo se llaman los robots que se utilizan para la exploración espacial, en medicina, en la industria, en la agricultura, los que
    13·1 answer
  • What would be the best tool to display the following information from a basketball game?
    6·1 answer
  • Sustainable development is a goal towards which all human societies need to be moving. elaborate the statement in about 120 word
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!