Test yourself on the scope with Python.
Quiz
1.
What is the scope according to Python of the variable “x”?
x=5
def my_func(a, b):
print(x)
x = 5
print(x)
A.
Local scope
B.
Global scope
C.
Nonlocal scope
D.
Error
1 / 3
Test yourself on the scope with Python.
Quiz
What is the scope according to Python of the variable “x”?
x=5
def my_func(a, b):
print(x)
x = 5
print(x)
Local scope
Global scope
Nonlocal scope
Error