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

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

What is the output of the following code ?

n2=4
def s(n1):
        print(n1)
        n1 = n1 +2
       n2=4
s(n2)
print(n2)
A)
B)
C)
D)

Explanation:

Here's how the code works:

  • n2 is 4 globally.
  • Inside the function s(n1), n1 is set to 4 (from n2).
  • The function prints 4 (the value of n1).
  • Modifying n1 inside the function doesn't affect the global n2.
  • After the function, the global n2 remains 4.

Output: 4 4

Answer: (C) 4 4

Latest Updates