QuestenaUn entraînement qui indique quoi revoir ensuite
Question 119

After list = [] executes in a scope, what does the name list resolve to in that scope?

  1. The built-in type, because built-ins cannot be rebound
  2. Both objects at once, chosen by call context
  3. The newly bound empty list objectBonne réponse
  4. No object, because the assignment is ignored

Explication

The assignment places a user binding named list in the current scope, so normal lookup finds that empty list object before the built-in type. Built-in names are ordinary names that can be shadowed; they do not automatically take precedence.

Continuer avec ce test

Commencer l’entraînement
Question 119: After list = [] executes in a scope, what does the name… · Python Fundamentals · Questena