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 osi reference model layer is responsible for transmitting information on computers connected to the same local area networ
Nikolay [14]
The data link layer (layer 2)
7 0
4 years ago
True or False: Wire service provide tabloid news reports to media outlets.
Setler79 [48]

Answer:

True

Explanation:

this is true and here is an explanation on how they operate.

New is readily available through various sources, newspapers, magazine, radio, tv,and the internet. Each of these sources in competition.

A given story most times had same content often times due to much dependence on wired services.

wire services would collect stories from reporters, edit them to standard format and then distribute to broadcast stations and print media.

3 0
3 years ago
PLEASE HELP 17 POINTS AND ILL MARK BRAINLIEST IF CORRECT , DONT GUESS
Lorico [155]

Answer:

A is the only answer that makes sense, although it is explained very poorly.

6 0
3 years ago
A simulation model includes: a. a description of the components of the system. b. a simulation clock. c. a definition of the sta
zloy xaker [14]

Answer: all of the above

Explanation:

8 0
3 years ago
How do I fix this stylesheet?
aalyn [17]

Answer:

i dont know

Explanation:

i m really sorry :(

6 0
3 years ago
Other questions:
  • Which new jobs will be in demand in the next 20 years
    5·1 answer
  • Is a type of software program used to write code and develop other
    9·1 answer
  • A computer with a domain name is called a
    8·2 answers
  • The program evaluation and review technique (PERT) is __________. a. a network-based technique in which there is a single time e
    15·1 answer
  • Which kind of system software tells the computer how to communicate with peripherals, such as a prero
    6·2 answers
  • In this lab, you will write a function called numberGuessingGame(). When the function is called, it will do the following: gener
    13·1 answer
  • In what year did the manager and team depicted in the blockbuster film "Moneyball
    9·1 answer
  • Which of the following protocols help IP in multicast service?
    9·2 answers
  • How to create create a database in mysql using clv files
    11·1 answer
  • If you want to create a line of code that will not appear in the interpreter, what symbol should begin the line?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!