Fs20co047 Py Exp 14
Fs20co047 Py Exp 14
FS20CO047
Experiment 14
Theory:
1. Explain set along with different operations.
A set is created by placing all the items (elements) inside curly braces
(
It can have any number of items and they may be of different types
(integer,
float, tuple, string etc.). But a set cannot have mutable elements like
lists, sets
Example:
add ("N")
B. union(s) Method: t returns a union of two set. Using the operator ’|’
between 2 existing sets is the same as writing
My_Set1.union(My_Set2).
Example:
Example:-
W=A.difference (B)
OR
SA-B
Example:
B.clear ()
Clears B set.
4 Python Exp 14
Practical:
a. Program for Create any two sets, (1,2,3,4) and (2,3,
5,4) and perform various operations on it.
Program:-
Observation:
a.
Output:-
Conclusion:
In the above experiment I learned how to use the sets in python and
perform various operations using it.