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
daser333 [38]
3 years ago
5

Use python

Computers and Technology
1 answer:
konstantin123 [22]3 years ago
6 0

Answer:

Here is the Python program:

def exec_2(f):

    f()

    f()

   

def exec_4(f):

    exec_2(f)

    exec_2(f)

   

def print_koala():

    print("koala")    

exec_4(print_koala)

Explanation:

The program works as follows:

First method:

def exec_2(f):

f()

f()

any function that is passed into exec_2() will be executed twice without parameters.

Second method:

def exec_4(f):

    exec_2(f)

    exec_2(f)

function exec_4(f) takes in a function f as a parameter and executes the function f 4 times using the function exec_2. At first exec_2(f) call the function f is executed twice and and second exec_2(f) call the function f is again executed twice so the function f executes 4 times in total.

Third method:

def print_koala():

    print("koala")  

a function that prints out the koala once

This function has a print statement which is passed the string koala to print on output screen.

exec_4(print_koala)

function exec_4 is used to print koala four times. This function exec_4 takes as argument the function print_koala() So this works as follows:

exec_4(print_koala)

The body of exec_4 executes as:

exec_2(print_koala)

exec_2(print_koala)

Now at first call to exec_2(print_koala) the program moves to the function exec_2 which executes print_koala()  method twice. Since print_koala() method has a print statement print("koala") so this is executed twice:

koala                                                                                                                                           koala

Now at second call exec_2(print_koala) the program moves to the function exec_2 which executes print_koala()  method twice again. Since print_koala() method has a print statement print("koala") so this is executed again twice:

koala                                                                                                                                           koala

So the output of the entire above program is:

koala                                                                                                                                           koala                                                                                                                                           koala                                                                                                                                           koala

The screenshot of program along with its output is attached.

You might be interested in
Which of the following is a valid JavaSript statement?
myrzilka [38]

Answer:

D

Explanation:

A and B are not valid because you cannot use "=" as a comparator (you must use "==" or "===").

C is not valid because the expression after the conditional is not a statement (it uses "==" instead of "=")

5 0
3 years ago
Read 2 more answers
When backing up a database server to LTO tape drives, the following schedule is used. Backups take one hour to complete.
AleksandrR [38]

Answer:

C. 3

Explanation:

Linear Tape Open LTO tape drives are magnetic tapes used to store data. This can be used with small and large computers for backup purposes. The backup needs to maintained frequently so that new data is backup on every interval. The is a RAID failure on database server to ensure complete backup there must be 3  backup tapes needed.

4 0
3 years ago
Guitar players calling their guitar an "axe" in the company of their bandmates is an example of:
Illusion [34]

Answer:

The answer is A

Explanation:

3 0
3 years ago
Read 2 more answers
Describe how to add images and shapes to a PowerPoint
kvasek [131]
You can use Microsoft paint to make the sales and then export them to Microsoft word or just go online and get the shapes images and copy and paste them on to the PowerPoint
8 0
3 years ago
What's the technique of drawing a 3D object with one vanishing point?​
zepelin [54]
I don’t no it brother n I was searching for this answer can u plz tell me
7 0
3 years ago
Read 2 more answers
Other questions:
  • Complete the following method named replaceEvens that receives the parameter numbers which is an array of integers. The method m
    5·1 answer
  • A(n _______________ is a pre-written formula that is built into excel
    12·1 answer
  • Specialized vocabularyis known as:
    12·1 answer
  • computer has a 32-bit instruction word broken into fields as follows: opcode, six bits; two register file address fields, five b
    11·1 answer
  • You are adding a new 500 GB hard drive to your computer. The hard drive must be formatted with a file system to organize files i
    8·1 answer
  • When you connect a device to your computer for the first time, Windows Media Player selects the ____ method that works best for
    15·2 answers
  • . How is using 0 / 1 or true / false in specifying digital an abstraction?
    11·1 answer
  • Why is it so important to adhere to principles that have been put forth by reputable organizations to ensure that you are mainta
    10·1 answer
  • 1.
    13·1 answer
  • What is the output of this program? Assume the user enters 2, 5, and 10.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!