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

निम्नलिखित कोड का परिणाम क्या है ?

What is the output of the following code ?

x = 50
def func (x) :
    x = 2
func (x)
print ('x is now', x) 
A
x is now 50
B
x is now 2
C
x is now 100
D
Error
Explanation

Sure!

Inside the function, x is set to 2, but this only affects the local x. The global x remains 50.

So, the output is x is now 50.

Answer: (A) x is now 50.

Correct Answer: A) x is now 50

Latest Updates