previous... next....
Python #7-Class and Objects in Python Python #9-Set Operations in Python
Syntax:
SetVariableName = {SetValues1, SetValues2, ..... }
Example:
Note Worthy: Set are Created by means elements inside the { , , , } are considers as set. Braces with no elements { } are consider as an empty dictionary. ....
Pros: This is the Advantage of using the set in the Python Programming..
Example:
Note: Set does not allow repetition of elements.
In the above example i have added banana to the Fruits set. Likewise you add many more to the set.
Example:
Example:
Python #7-Class and Objects in Python Python #9-Set Operations in Python
What are sets in python?
A set is an unordered collection with no duplicate elements.
How to create set?
Use { , , , } - To create a set
Syntax:
SetVariableName = {SetValues1, SetValues2, ..... }
Example:
Note Worthy: Set are Created by means elements inside the { , , , } are considers as set. Braces with no elements { } are consider as an empty dictionary. ....
Set with Duplicate Elements get eliminated automatically.
Try it....Pros: This is the Advantage of using the set in the Python Programming..
*********You can able to perform add, delete, update in set.************
Example:
Try the adding elements to the set..
In the above example i have added banana to the Fruits set. Likewise you add many more to the set.
Example:
Try the deleting elements from the set..
Example:
Try Updating the elements in the set....
Thanks and Regards,
Come back to learn more from Tech bird
Comments