हिंदी

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 - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

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?

विकल्प

  • global a
  • global b=100
  • global b
  • global a=100
MCQ

उत्तर

global b

Explanation:

The global keyword allows the function to access the global variable b.

shaalaa.com
Scope of a Variable
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2023-2024 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×