1. Home
  2. Data Science
  3. Python
  4. What will be the output of len({'a': 1, 'b': 2, 'c': 3})…

Added 4 May 2024

What will be the output of len({'a': 1, 'b': 2, 'c': 3}) in Python?

  1. 1
  2. 2
  3. 3 Correct answer
  4. Error

Correct answer

C. 3

15 views

MCQSEXAM

Explanation

The len() function returns the number of key-value pairs in a dictionary, so the result is 3.

Doubts & discussion

Not sure why the answer is C? 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