ProgrammingEasyTCS NQT · Wipro pattern
What is printed?
What is printed?
print(len({1, 2, 2, 3, 3, 3}))- A. 4
- B. 6
- C. 1
- 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
- Which keyword turns an ordinary Python function into a generator function?
- What is printed? python x = [1, 2, 3] x.append([4, 5]) print(len(x))
- What is printed? python print(2 3 2)
- What is printed? python print(-7 // 2, -7 % 2)
- What is printed? python a = [1, 2, 3] b = a b += [4] print(a)
- What is printed? python print(bool("False"), bool(""), bool(0.0))