Python Programming Language: Computer Application:
Python Programming Language | Sets and Operations | Frozensets | Lecture 8
Review:
In the previous two videos we studied about Mutable & Immutable Objects and Tuples and compared it to List.
Mutable means the one which can be changed or the one which can be modified.
Examples of mutable objects in Python are List, Set & Dictionaries.
Immutable means the one which cannot be changed.
Example of Immutable object is Python are Integer, String, Boolean, Float, Tuple, Frozenset.
Tuples are instruction similar to List, but are Immutable.
Tuple are simpler than List but they need not be in parenthesis when creating.
We can change List into Tuple and Tuple into List.
In this video we shall see about SETS and SET OPERATIONS:
A Set is a collection of unique elements. A collection of well-defined unique elements.
Operations are the various operations performed between different sets, such as Union, Intersection, etc.
Union of set between any two set is the new set with all the elements present in both the sets without repetition.
Intersection between any two sets is the common element between both the sets, or the elements present in both the sets.
Difference between two set is the set of elements present in the first set and not in the second set.
List of elements could be anything, written within a flower bracket or curly brackets.
Name of the set is always denoted by a capital letter.
Disjoint sets are two such sets which have no elements common between them.
Various commands related to Sets in Python:
Add, Discard, Clear, Pop, Update, Remove, Copy, Intersection, Union, Difference, intersection_update, Symmetric_difference, Subset, Superset, Disjoint, Difference_ update, Symmetric_difference_ update,
When do we use sets in programming: What are the advantages of using sets in programming:
When sequence of the elements or collection of elements where repetition of elements are not desired. For example a set that contains people’s name.
Frozensets - Frozensets are objects like sets, but they are immutable.
Various commands related to Frozensets in Python:
Copy, Intersection, Union, Difference, Symmetric_difference, Subset, Superset, Disjoint
Frozensets are important when we discuss dictionaries, which we will see in the nest video.
Dictionaries have keys and values,
Video by Edupedia World (www.edupediaworld.com), Free Online Education;
Download our App : https://goo.gl/1b6LBg
Click here https://goo.gl/HjNegN to watch more videos on Python Programming Language- Complete Tutorial;
All Rights Reserved.