QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 78

Spot the default-parameter error: a teammate says the expression used as a parameter default is evaluated anew every time the caller omits that argument. What is the correction?

  1. The default expression runs when def executes.Ճիշտ պատասխան
  2. The default expression runs after the program ends.
  3. The default expression runs only on the second call.
  4. The default expression is always evaluated per call.

Բացատրություն

The default expression is evaluated when Python executes the def statement, and that resulting value is retained for omitted arguments. Recomputing it on every call would describe different behavior from Python's parameter defaults.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 78: Spot the default-parameter error: a teammate says the… · Python Fundamentals · Questena