-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionary.py
More file actions
88 lines (57 loc) · 1.17 KB
/
Dictionary.py
File metadata and controls
88 lines (57 loc) · 1.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
tel={'jac':1,'sym':2}
tel['u']=3
tel['c']=4
print(tel)
print(tel['jac'])
del tel['c']
print(tel)
tel['x']=5
tel['b']=7
sorted(tel)
print(tel)
w=dict([('hello',1),('yes',2),('you',3)])
print(w)
#dict compreshensions
print(x: x**3 for x in (3,4,5))
for k in knights.items():
print(k)
for w,e in enumerate(knights):
print(w,e)
for r,y in enumerate([1,2,34,45]):
print(r,y)
x=list(knights)
print(x)
print(sorted(knights))
print('gm' in knights)
print('ritu' in knights)
question=['a','b','c','d']
print(type(question))
answer=['one','two','three']
for a,b in zip(question,answer):
print(a,b)
for x in zip(question,answer):
for c in x:
print(c,x)
print(type(x),type(c))
#traversed through both the values
b="my name is z"
knights={'hello':'ritu','gm':'rishabh sir'}
i=[9,4,6,2,3]
#problem occured
p=set(i)
print(p)
for i in knights.items():
print(i)
print(i)
#cz python is a interpreter language
for j in i:
print(j)
print(j)
#problem till here
te=1,3,5,7,9
for c in reversed(range(1,10,2)):
print(c)
basket=['set','pen','bat','hello','table','pen']
n={x : x*2 for x in basket }
for q,w in n.items():
print(q,w)