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
Assume you have written a method with the header num yourMethod(string name, num code). The method's type is ____ .
elena-s [515]

A method is written with the header 'num' yourMethod(string name, num code). The method's type is <u>'num'.</u>

In the context of programming. a header refers to supplemental data placed at the beginning of a block of data being transmitted or stored. In the context of the Java method, the header is where you tell the Java program what value type if any, the method will return (a string value, an int value, a double value,  etc). As well as the return type, you require a name for your method, which is also placed in the header. You can pass values over to your methods in between a pair of round brackets.

You can learn more about method in Java at

brainly.com/question/28489761

#SPJ4

8 0
1 year ago
How to bypass a Lightspeed and Rocket Filter blocked website without being a admin and without downloading extensions? Must incl
AVprozaik [17]

You really cant without being admin. Calm yaself child

6 0
2 years ago
Convert the following four unsigned binary numbers to decimal and show your work:
Ber [7]

Answer:

23 ,21,10,63,13

Explanation:

We have to convert binary to decimal

10111 corresponding decimal number is

1\times 2^4+0\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=23

10101 corresponding decimal number is

1\times 2^4+0\times 2^3+1\times 2^2+0\times 2^1+1\times 2^0==21

01010 corresponding decimal number is

0\times 2^4+1\times 2^3+0\times 2^2+1\times 2^1+0\times 2^0=10

111111 corresponding decimal number is

1\times 2^5+1\times 2^4+1\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=63

001111 corresponding decimal number is

0\times 2^5+0\times 2^4+1\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=13

7 0
3 years ago
Write a program that asks the user for the name of a text file. the program should display the last 10 lines of the file on the
Tom [10]
The only thing that I know is that after you input the text file, it could either:
-save those lines as a variable
-display the text file
However any more would be dependent on the language.
3 0
3 years ago
Carlos had 194 seeds and 11 flower pots he put the same number of seeds in each flower pot which is the best estimate for the nu
Anon25 [30]

Answer: in solution.

Explanation:

It is basically 194 divided by 11 since we are evenly grouping 194 seeds into 11 pots. This gives 17.636363…

This means that the best estimate is around that number.

6 0
2 years ago
Other questions:
  • What component of effective feedback is demonstrated by giving examples of what an employee is doing right instead of just prais
    14·2 answers
  • What education and training is required to be an applications software engineer?
    9·1 answer
  • Select the best answer for the question. 2. What is the simplest way to permanently get rid of an unwanted file?
    13·1 answer
  • What is the problem with the code snippet below? public class Test { public static void main(String[] args) { System.out.println
    6·1 answer
  • Mac or PC (need opinions please)<br><br> Why did you choose Mac/PC?
    10·2 answers
  • What is the Gain (dB) of a transmission if the Maximum Data Rate is 1 Gbps and the Bandwidth =7000 MHz? Group of answer choices
    6·1 answer
  • Declare an ArrayList of Strings. Add eight names to the collection. Output the Strings onto the console using the enhanced for l
    9·1 answer
  • A computer is performing a binary search on the sorted list of 7 numbers below. What is the maximum number of iterations needed
    15·1 answer
  • 1: define about information system in computer?
    10·1 answer
  • Choose the missing term.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!