-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpro5.py
More file actions
66 lines (59 loc) · 1.53 KB
/
Copy pathpro5.py
File metadata and controls
66 lines (59 loc) · 1.53 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
'''dir() returns a list of attributes + methods of an object.'add','remove','update','clear','union'
A set is a collection that is:Unordered,Unique elements only,Mutable,Only hashable (immutable) items allowed'''
# 1> wap to take input 1 dir hindi and english taking as list
words = {"namasta":"greeting",
"bolo":"speak",
"nahi":"nah",
"shukriya":"thanks"
}
word=input("Enter your word:")
print(words[word])
# 2>wap to take 4 no as input and display uniuqe once
e=set()
f1=int(input("Enter you number:"))
e.add(f1)
f2=int(input("Enter you number:"))
e.add(f2)
f3=int(input("Enter you number:"))
e.add(f3)
f4=int(input("Enter you number:"))
e.add(f4)
print(e)
# 3>can we have a set with 18 int and 28 as str value
e=set()
e.add(18)
e.add('28')
print((e))
# 4>find len of the set
s=set()
s.add(20)
s.add(20.0)
s.add('20')
print(len(s))
# 5find the type
s={}
print(type(s))
# 6>create a empty dir take 4 value as inpput based on name:languages
s={}
name=input("enter your name and lanugae:")
lan=input("enter your lanugae:")
s.update({name:lan})
name=input("enter your name and lanugae:")
lan=input("enter your lanugae:")
s.update({name:lan})
name=input("enter your name and lanugae:")
lan=input("enter your lanugae:")
s.update({name:lan})
name=input("enter your name and lanugae:")
lan=input("enter your lanugae:")
s.update({name:lan})
name=input("enter your name and lanugae:")
lan=input("enter your lanugae:")
s.update({name:lan})
print(s)
# 7> slove this problem
s={8,7,9,"harry",(1,2)}
s.remove((1,2))
print(s)
s.add((2,3))
print(s)