A

Admin • 831.35K Points
Coach

Q. What is the output of this code?

Code:
a = {1, 2, 3}
a.add(2)
print(a)
  • (A) {1, 2, 3}
  • (B) {1, 2, 3, 2}
  • (C) {1, 2}
  • (D) {2, 2, 3}
  • Correct Answer - Option(A)
  • Views: 15
  • Filed under category Python
  • Hashtags:

Explanation by: Admin
Sets do not allow duplicate values; `2` is already present.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.