Advertisements
Advertisements
Question
Consider the code given below:
b=100
def test(a):
______________ # missing statement
b=b+a
print (a,b)
test (10)
print (b)
Which of the following statements should be given in the blank for #Missing Statement, if the output produced is 110?
Options
global aglobal b=100global bglobal a=100
MCQ
Advertisements
Solution
global b
Explanation:
The global keyword allows the function to access the global variable b.
shaalaa.com
Scope of a Variable in Python
Is there an error in this question or solution?
