Repository navigation
Expand file tree
/
Copy pathDICT.py
More file actions
executable file
·77 lines (64 loc) · 1.67 KB
/
Copy pathDICT.py
File metadata and controls
executable file
·77 lines (64 loc) · 1.67 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
#we can update direclty uding _update() with union,difference,inteersection etc...
#.........................DICT........................
#DICTIONARY---it contains certain keys and values, keys are always unique and derived dtata type not consider as keys
#Key:value
# it doesnt support indexing and slicing
#contain hetrogenous data
#mutable in nature
#key will never be duplicate
"""
d={}
print("d==",d,type(d))
d1=dict()#empty dict
print(d1)
d2={"a1":12,"b2":45,89:"hey"}
print(d2)
print("keys---",d2.keys())
print("values---",d2.values())
#if one keys has two different then it override the data
d2={"a1":12,"b2":45,89:"hey","a1":"Himanshu"}
print(d2)
#in dictionary we have extraction, we can get any data with the help of keys(pass keys and get vaues)
print("indexing keys",d2["b2"])
#t=d3.pop(key)
#d1.udate(d2)
#zip
key=["name","add","number",]
value=["Himanshu","Delhi","1234",]
z=zip(key,value)
di=dict(z)
print(di)
print(dir(d))
d3={"e1":15,"f1":49,"g1":69}
print(d3.keys())
print(d3.values())
d4={**d3,**d2}
print(d4)
print(type(d4))
"""
# def dec(a):
# def indec(name):
# if name == "Himanshu":
# print("hi",name)
# else:
# a(name)
# return indec
# @dec
# def hi(name):
# print("hello")
# hi("Himanshu")
# print(h)
# def dec(a):
# def indec(name):
# if name == "sam":
# print("hey",name)
# else:
# a(name)
# return indec
# @dec #it is use to connect normal function with decorator-----@ is use to connect
# def wish(name):
# print("Hello",name,"Welcome")
# wish("Himanshu")
# wish("sam")
d2={"a1":12,"b2":45,89:"hey","a1":"Himanshu"}
print(d2)