QuestenaPráctica que te muestra qué repasar después
Pregunta 109

A function definition uses a list as a parameter default. When is that list created, and what happens when later calls omit the argument?

  1. It is created at def time and reused.Respuesta correcta
  2. A new copy is made before every call.
  3. It is created only after the first return.
  4. A new object is created for each omission.

Explicación

The list is created as the def statement executes, and omitted arguments bind to that same object on later calls. Assuming a fresh list or an automatic copy for every call hides the sharing that makes mutable defaults risky.

Continúa con este test

Empezar la práctica
Pregunta 109: A function definition uses a list as a parameter default.… · Python Fundamentals · Questena