
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements