Report Bug
Qus :

What will be printed?

x = 5
def f():
    global x
    x = 10
f()
print(x)

Qus

निम्न code क्या print करेगा?

x = 5
def f():
    global x
    x = 10
f()
print(x)



A. 5
B. 10
C. Error
D. None


Solution
B. 10



Explanation
global x allows the function to modify the global variable. <br><br> global x function को global x की value बदलने की अनुमति देता है।



Report Bug