निम्नलिखित कोड का परिणाम क्या है ?
What is the output of the following code ?
x = 50
def func (x) :
x = 2
func (x)
print ('x is now', x)
A)
B)
C)
D)
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.