Quiz Yourself on Scope in Python

Test yourself on the scope with Python.

We'll cover the following...

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

Question 1 of 30 attempted
Access this course and 1400+ top-rated courses and projects.