Report Bug

Qus

Read the following Python code carefully and point out the global variables?

  y, z = 1, 2  def f():      global x      x = y+z
Qusनिम्नलिखित पायथन कोड को ध्यान से पढ़ें और ग्लोबल वैरिएबल को पॉइंट आउट करें?


A. x
B. y and z
C. x, y and z
D. Neither x, nor y, nor z


Solution
C. x, y and z



Explanation
In the code shown above, x, y and z are global variables inside the function f. y and z are global because they are not assigned in the function. x is a global variable because it is explicitly specified so in the code. Hence, x, y and z are global variables.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad