What method is used to add a single element to a set in Python?
- add()
- append()
- insert()
- update()
The add() method is used to add a single element to a set in Python. It takes one argument, the element you want to add, and modifies the set in place.
Loading...
Related Quiz
- If a class has the slots attribute defined, it means the instances of that class will not have a _______ dictionary.
- In pytest, the ____ fixture is used to pass command-line options to test functions.
- In Python, _____ is a special method used to overload the ‘+’ operator for custom objects.
- In Scikit-learn, the ____ method is used to calculate the accuracy of the model on the test data.
- How can you find the mean of all elements in a NumPy array?