What is the purpose of the intersection() method for sets?
A. Returns a new set with elements common to both sets
B. Returns the union of two sets
C. Returns the difference of two sets
D. Returns the symmetric difference of two sets
Answer: Option A
A. Returns a new set with elements common to both sets
B. Returns the union of two sets
C. Returns the difference of two sets
D. Returns the symmetric difference of two sets
Answer: Option A
Which of the following data types in Python is mutable and does not allow duplicate elements?
A. Set
B. List
C. Tuple
D. Dictionary
What does the len() function do when applied to a set or tuple?
A. Returns the number of elements in the set or tuple
B. Converts the set or tuple to lowercase
C. Converts the set or tuple to uppercase
D. Removes the last element
Join The Discussion