The program demonstrates how to create and manipulate sets in Python using the add and update methods.
In this program, the methods add and update are used to add elements to the set. The update method can be used to add multiple elements to the set, while the add method can be used to add only a single element.
animal = {"Lion","Cat"} print(animal) animal.add("Dog") print("Add single element : ",animal) animal.update(["Ponda", "Tiger"]) print("Add multiple items : ",animal)
{'Cat', 'Lion'} Add single element : {'Cat', 'Lion', 'Dog'} Add multiple items : {'Cat', 'Ponda', 'Lion', 'Dog', 'Tiger'}
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions