T

Tanmay • 2.43K Points
Master

Q. What is the output of the following code when executed in Python shell?

Code:
>>> d = {1,2,3}
>>> d.intersection_update({2,3,4,5})
>>> d
  • (A) {2,3}
  • (B) Error, duplicate element in the list
  • (C) {1,4,5}
  • (D) Error, no method called intersection_update
  • Correct Answer - Option(A)
  • Views: 122
  • Filed under category Python

Explanation by: Tanmay
The intersection_update method returns a set that contains the intersection of the two sets.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics