adplus-dvertising
frame-decoration

Question

What is the output of the code shown below?
def mk(x):
    def mk1():
        print("Decorated")
        x()
    return mk1
def mk2():
    print("Ordinary")
p = mk(mk2)
p()

a.

Decorated
Decorated

b.

Ordinary
Ordinary

c.

Ordinary
Decorated

d.

Decorated
Ordinary

Posted under Python

Answer: (d).Decorated
Ordinary

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the code shown below?