🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित पायथन कोड का आउटपुट क्या होगा?

What will be the output of the following Python code ?

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)
B)
C)
D)

Explanation:

The power function calculates x raised to the power of y. By default, y = 2.

  1. First call: power(3)3^2 = 9
  2. Second call: power(3, 3)3^3 = 27

Output:
9 27

Answer: (B) 9 27

Latest Updates