ProgrammingEasyTCS NQT · Wipro pattern

What is printed?

What is printed?
print(len({1, 2, 2, 3, 3, 3}))
  1. A. 4
  2. B. 6
  3. C. 1
  4. D. 3

Correct answer: D. 3

A set keeps only distinct elements, so {1, 2, 2, 3, 3, 3} is {1, 2, 3} and its length is 3.

More Python Programming questions

Exams that ask this topic