forked from Ragupathi-vglug/python-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSets .py
More file actions
40 lines (30 loc) · 665 Bytes
/
Sets .py
File metadata and controls
40 lines (30 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#SET
# A set is an immutable and unoredred . We can't change anything but we can add a value.
a={1,2,241,131,"ragu",True}
print(a)
print(type(a))
for value in a:
print(value)
# Adding a value
a.add("ragupathi")
print(a)
# UPDATING A SET
b={"pradeep",1,2,3,4}
a.update(b)
print(a)
# Set functions
#Union
ragu={1,2,3,4,5}
pathi={5,6,7,8,9,0}
adding=ragu.union(pathi)
print(adding)
# Intersection
print(ragu.intersection(pathi))
# Symmetric difference
print(ragu.symmetric_difference(pathi))
# Disjoint
print(ragu.isdisjoint(pathi))
# suset
print(ragu.issubset(adding))
# Super set
print(adding.issuperset(ragu))