OBJECTIVE ASSESSMENT
COMPREHENSIVE REVIEW GUIDE WITH
VERIFIED ANSWERS 2026
⩥ Len(). Answer: Returns the number of characters in a text string
⩥ Set(). Answer: unordered collection of unique elements.
• Elements are unordered: Elements in the set do not have a position or
index.
• Elements are unique: No elements in the set share the same value.
⩥ How to add elements to a set?. Answer: set.add(value)
Ex: my_set.add('abc')
⩥ How to remove random item from a set?. Answer: set.pop()
Ex: my_set.pop()
, ⩥ How to remove item from a set?. Answer: set.remove(value)
Raises KeyError if value is not found.
Ex: my_set.remove('abc')
⩥ How to add items from one set to another set?. Answer:
set1.update(set2)
Adds the elements in set2 to set1.
⩥ How to clear all elements from a set?. Answer: set.clear()
⩥ set.intersection(). Answer: Returns a new set containing only the
elements in common between set and all provided sets.
⩥ set.union(). Answer: Returns a new set containing all of the unique
elements in all sets.
⩥ set.difference(). Answer: Returns a set containing only the elements of
set that are not found in any of the provided sets.