What is the output of `dict([(1, 2), (3, 4)])`?

  1. {1: 2, 3: 4}
  2. [1: 2, 3: 4]
  3. {(1, 2), (3, 4)}
  4. [(1, 2), (3, 4)]
Correct answer {1: 2, 3: 4}

Explanation

`dict()` can take a list of 2-item tuples and convert them into a dictionary.

Update: Admin added a tag on this question

Topics

By Admin · · 22 views