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

A dictionary receives keys in the order `b`, `a`, then `c`. In what order does ordinary iteration yield those keys?

  1. A new random order each time
  2. `a`, `b`, `c` because keys are sorted
  3. `b`, `a`, `c` in insertion orderՃիշտ պատասխան
  4. The values rather than the keys

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

Dictionary iteration follows insertion order, so the keys appear as `b`, `a`, then `c`. The runtime does not sort them alphabetically for ordinary iteration or deliberately randomize their sequence.

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

Սկսել վարժանքը
Հարց 39: A dictionary receives keys in the order `b`, `a`, then `c`.… · Python Fundamentals · Questena