dict_construct.py 190 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# dict constructor

d = dict()
print(d)

d = dict({1:2})
print(d)

d = dict(a=1)
print(d)

d = dict({1:2}, a=3)
print(d[1], d['a'])

d = dict([(1, 2)], a=3, b=4)
print(d[1], d['a'], d['b'])