adplus-dvertising
frame-decoration

Question

What is the output of the below program?
def power(x, y=2):
    r = 1
    for i in range(y):
       r = r * x
    return r
print power(3)
print power(3, 3)

a.

212
32

b.

9
27

c.

567
98

d.

None of the mentioned

Posted under Python

Answer: (b).9
27

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 below program?