Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the output of the following piece of code when executed in the python shell?

    a={1,2,3}
     a.intersection_update({2,3,4,5})
     a
  2. A.
    {2,3}
    B.
    Error, duplicate item present in list
    C.
    Error, no method called intersection_update for set data type
    D.
    {1,4,5}

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    The method intersection_update returns a set which is an intersection of both the sets.


Be The First To Comment