In Python:
def exec_2(f):f()f()
Any function that is passed into exec_2() will be executed twice without parameters. Your task is to write a function exec_4(f) that takes in a function f as a parameter and executes the function f 4 times using the function exec_2. The function f in this case will draw a cute koala bear, and, in conjunction with, exec_4(), you will draw 4 koalas on the same tree! Suppress the newline in the print statement for the koala, this can be done using print's end argument.
def exec_2(f):f()f()def exec_4(f):# define this function using exec_2 # define a new function here that prints out the koala once# use your function and exec_4 to draw 4 koala bears!

Solved
Show answers

Ask an AI advisor a question