Repository navigation
Expand file tree
/
Copy pathSET.PY
More file actions
159 lines (125 loc) · 2.17 KB
/
Copy pathSET.PY
File metadata and controls
159 lines (125 loc) · 2.17 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#set : mutable ==> no repeation allow in set .
"""
s1 ={1,2,23,3,4,4,5,6,7,8,9,9,10}
print(s1)
print(type(s1))
"""
# built in function : len min max sorted
# s1 ={1,2,23,3,4,4,5,6,7,8,9,9,10}
"""print(len(s1))
print(min(s1))
print(max(s1))
print(sorted(s1))
print(sum(s1))
"""
"""l1=[1,2,2,3,3,4,4,5,5,6,6,7,7,8,9,10]
l2=set(l1)
print(list(l2))
"""
# empty set :
"""s2 =set()
print(s2)
print(type(s2))"""
# method :
# s1 ={1,2,23,3,4,4,5,6,7,8,9,9,10}
# s1.add(250)
# print(s1)
# s1.clear()
# print(s1)
# s2=s1.copy()
# print(s2)
# s1={1,2,3,4}
# s2={3,4,5,6}
# s3 = {1,2,3,4,5,6}
"""print(s1.union(s2))
print(s1.intersection(s2))
print(s1.difference(s2)) # s1 -s2
print(s2.difference(s1)) # s2 -s1
"""
# print(s1.intersection(s2))
# print(s1)
# s1.intersection_update(s2)
# print(s1)
# print(s1.difference(s2))
# s1.difference_update(s2)
# print(s1)
# print(s1.symmetric_difference(s2))
# s1.symmetric_difference_update(s2)
# print(s1)
"""
s1={1,2,3,4}
s2={5,6}
s3 = {1,2,3,4,5,6}
"""
# print(s1.isdisjoint(s2))
# print(s3.issuperset(s1))
# print(s1.issubset(s3))
s1 ={11,1,2,23,3,4,4,5,6,7,8,9,9,10}
"""s1.discard(20)
print(s1)
"""
"""s1.remove(40)
print(s1)"""
"""s1.pop()
print(s1)"""
"""s2={"ram","sita"}
s1.update(s2)
print(s1)
"""
# frozenset : immutable
"""fz =frozenset({1,2,3,4,5,5,6})
print(fz)
print(type(fz))
"""
# function :
"""
1. no arg no return
2. no arg with return
3. with arg no return
4. with arg with return
"""
# 1. no arg no return
"""def sum():
a = 10
b = 20
c =a+b
print(c)
sum()"""
# 2 . with arg no return
"""def sum(a,b):
c=a+b
print(c)
a =int(input("enter : "))
b =int(input("enter : "))
sum(a,b)
"""
# 3. no arg with return :
"""def sum():
a=int(input())
b=int(input())
c=a+b
return c
print(sum())
"""
# with arg with return :
"""def sum(a,b):
c=a+b
return c
a=int(input())
b=int(input())
print(sum(a,b))
"""
# *arg :
"""def sum1(*arg):
sum=0
for i in arg:
sum =sum +i
print(sum)
sum1(10,20,30,40,50,60,70)
"""
# **kwarg :
'''def d1(**kwarg):
for i,j in kwarg.items():
print({i:j})
d1(name="ram",city="jungle",age=30)
'''