← All topics
Quiz: Scope and Closures: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. In which order does Python search for a name?
- Q2. What does this print? (code)
- Q3. What does this print? (code)
- Q4. What error do you get if an inner function does count += 1 on an enclosing variable without nonlocal?
- Q5. What is a closure?
- Q6. What does this print? (code)
- Q7. Given def f(a, , b):, which call is valid?
- Q8. What does / mean in def area(r, /, unit="cm"):?
- Q9. What does this print? (code)
- Q10. What is the value of middle after a, middle, z = "python"?