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.
Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad