✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Una variable nonlocal fa referencia a que el seu ús dins una rutina no implica un ús local, sinó que es tracta d'una variable definida en una rutina superior.
Exemple:
def fun():
x = "local"
def subfun(): nonlocal x x = "nonlocal" print("subfun:", x)
subfun() print("fun:", x)
fun()
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!