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
An intranet is an external network.TrueFalse
maria [59]

Answer:

False

Explanation:

An intranet is not an external network.

An intranet is an internal network which is established by an organization for its own use.

External people can not access the Intranet unlike the internet which is accessible to every one.

An organization owns a private network which is called an intranet. Private means that the network is accessible to all those employed within the organization, staff of the company.

Intranet exists only within the company and indicates the following.

1. The company establishes its own network inside the company so that the staff of the company can access and exchange information among themselves.

2. The staff can communicate and have discussions on the network.

3. The information is not accessible to outside parties such as customers, stakeholders, and others.

4. The network is not accessible and does not exists for the outside parties.

5. The term intra means inside and net means network.

Intranet leads to the following benefits.

1. The staff can view and exchange information with more ease and comfort and in less time.

2. Faster access to information increases employee output. Employees can perform better and have more time to focus on their work.

3. Communication among the employees is encouraged and made easy. Any one can communicate with every one in the company.

4. More communication leads to better working relationships among the staff. Cooperation and collaboration among the staff is given a boost.

5. Staff can give their input for the type of information to be held in the respository. This serves as the single point of information which enables smooth work flow.

Intranet also has some drawbacks.

The employees can take undue advantage of this communication channel for personal communications and information exchange.

Unproductive communication can only hamper the culture of the workplace.

Guidelines should be enforced to avoid unnecessary communication.

3 0
3 years ago
Write a program that prints the block letter “B” in a 7x7 grid of stars like this:
makkiz [27]

Answer:

  1. output = ""
  2. for i in range(7):
  3.    if(i % 3 == 0):
  4.        for i in range(5):
  5.            output+= "*"
  6.        output += "\n"
  7.    else:
  8.        for i in range(2):
  9.            output += "* "
  10.        output += "\n"
  11. print(output)

Explanation:

The solution code is written in Python 3.

Firstly, create a output variable that holds an empty string (Line 1).

Create an outer loop that will loop over 7 times to print seven rows of stars (Line 2). In row 0, 3 and 6 (which are divisible by 3) will accumulate up to 5 stars using an inner loop (Line 4-5) whereas the rest of the row will only print two stars with each start followed by a single space (Line 8-9) using another inner loop.

At last, print the output (Line 12).  

6 0
3 years ago
Which of the following cannot be used in MS Office.<br> Joystick<br> Scanner<br> Light Pen<br> Mouse
ValentinkaMS [17]

Answer:

A.

Explanation:

A Joystick is a control device that is connected to the computer to play games. A joystick is similar in structure to a control stick used by pilots in airplanes and got its name from the same. A joystick contains a stick, base, extra buttons, auto switch fire, trigger, throttle, POV hat, and a suction cup. A joystick also serves the purpose of assistive technology.

The device which can not be used in MS Office is a joystick. Therefore, option A is correct.

6 0
2 years ago
The PRNG variable ___________ is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cr
Kamila [148]

Answer:

Strength

Explanation:

A huge number of systems use a process called Pseudo Random Number Generation (PRNG). In NIST SP 800-90, The PRNG has a set of parameters that define various variables within the algorithm. The PRNG variable strength is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cryptographic algorithm or system.

3 0
3 years ago
The letters a, e, i, o and u are the only vowels. Write a function named vowelUseDict() takes a string t as a parameter and comp
Andru [333]

Please specify the programming language.


3 0
3 years ago
Other questions:
  • Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest
    10·1 answer
  • In Paint, which of the following are ways to use a picture that you have saved on your computer? (Select all that apply.)
    8·1 answer
  • What's the 16-bit hexadecimal representation of the signed decimal integer, -331? Answeers?
    14·1 answer
  • By default, windows does not display ____________________ in windows explorer.
    8·1 answer
  • 7. Which innovation in video games do you think has been most significant? Include at least one way that innovation affects the
    6·1 answer
  • Second Largest, Second Smallest Write a program second.cpp that takes in a sequence of integers, and prints the second largest n
    15·1 answer
  • How can you say that a painting is real? ​
    7·2 answers
  • How do you use switch board in the office​
    6·1 answer
  • write ms-dos command to list all the files and folders of EIGHT sub directory of C: drive in ascending order according to file n
    5·1 answer
  • In this lab, you complete a C++ program that uses an array to store data for the village of Marengo.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!