
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Internal working of Set in Python
In this article, we will learn about the Internal working of Set in Python. We will observe the union and intersection operation in different frames and objects.
Let’s declare an empty set.
>>> s=set()
Now let’s declare a set with elements.
>>> s1=set('tutorialspoint')
Adding an element into an empty set.
>>> s.add(‘p’)
Now we declare another set with the name of Python.
>>> s2=set('python')
Now let’s see the union operation.
>>> s3=s1.union(s2)
Finally, we implement the intersection option.
>>> s4=s1.intersection(s2)
Conclusion
In this article, we learned about the Internal working of Set in Python 3.x. Or earlier
- Related Articles
- Internal working of Set/HashSet in Java
- Internal working of Python
- Internal working of the list in Python
- Internal Working of HashMap in Java
- The internal working of the ‘foreach’ loop in PHP
- How to set the current working directory in Python?
- Modification not working for both internal table and control table in SAP ABAP
- Set Text Alignment Working with CSS
- Internal Python object serialization (marshal)
- Working with Images in Python?
- Demonstrate the working of violin plots in Python?
- How to flush the internal buffer in Python?
- Working with PDF files in Python?
- Working with zip files in Python
- Python - Working with buttons in Kivy

Advertisements