1. Home
  2. Data Science
  3. Python
  4. What is the output of print(list({'a': 1, 'b'…

Added 25 Nov 2026

What is the output of print(list({'a': 1, 'b': 2}.items())) in Python?

print(list({'a': 1, 'b': 2}.items()))
  1. ['a', 'b']
  2. [('a', 1), ('b', 2)] Correct answer
  3. [1, 2]
  4. {'a': 1}

Correct answer

B. [('a', 1), ('b', 2)]

6 views

MCQSEXAM

Explanation

items() returns key-value pairs as tuples.

Reference

Asked in: Python Interview Dictionaries

https://docs.python.org/3/tutorial/datastructures.html#dictionaries

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs