QuestenaUn entraînement qui indique quoi revoir ensuite
Question 79

Given def total(*args): return args, what does args receive in the call total(2, 3)?

  1. A list containing 2 and 3
  2. A dictionary of keyword arguments
  3. A tuple containing 2 and 3Bonne réponse
  4. The product 6

Explication

The starred parameter gathers unmatched positional arguments, preserving their order in a tuple. Treating args as a list or as a receiver for keyword arguments assigns it the wrong container or argument category.

Continuer avec ce test

Commencer l’entraînement
Question 79: Given def total(*args): return args, what does args receive… · Python Fundamentals · Questena