Complete the code to add the element 5 to the set.
numbers = {1, 2, 3, 4}
numbers.[1](5)
print(numbers)The add() method adds a single element to a set.
Complete the code to remove the element 3 from the set.
numbers = {1, 2, 3, 4}
numbers.[1](3)
print(numbers)pop() which removes an arbitrary element.discard() which does not raise an error if element missing.The remove() method removes a specific element from a set and raises an error if the element is not found.
Fix the error in the code to correctly add the element 10 to the set.
my_set = {7, 8, 9}
my_set.[1](10)
print(my_set)Sets use add() to add elements, not list methods like append().
Fill both blanks to remove element 2 safely and add element 5 to the set.
numbers = {1, 2, 3, 4}
numbers.[1](2)
numbers.[2](5)
print(numbers)remove which can cause errors if element is missing.discard() removes an element without error if missing, and add() adds an element.
Fill all three blanks to add 'apple', remove 'banana' safely, and remove an arbitrary element.
fruits = {'banana', 'cherry'}
fruits.[1]('apple')
fruits.[2]('banana')
removed = fruits.[3]()
print(fruits)
print('Removed:', removed)remove instead of discard for safe removal.pop incorrectly.add() adds an element, discard() removes an element safely, and pop() removes and returns an arbitrary element.