2013-12-29 17:34:42 -05:00
|
|
|
# basic dictionary
|
|
|
|
|
|
|
|
d = {}
|
|
|
|
print(d)
|
|
|
|
d[2] = 123
|
|
|
|
print(d)
|
|
|
|
d = {1:2}
|
|
|
|
d[3] = 3
|
2016-04-15 11:28:33 -04:00
|
|
|
print(len(d), d[1], d[3])
|
2013-12-29 17:34:42 -05:00
|
|
|
d[1] = 0
|
2016-04-15 11:28:33 -04:00
|
|
|
print(len(d), d[1], d[3])
|
|
|
|
print(str(d) == '{1: 0, 3: 3}' or str(d) == '{3: 3, 1: 0}')
|
2013-12-29 17:34:42 -05:00
|
|
|
|
|
|
|
x = 1
|
2016-02-12 18:38:30 -05:00
|
|
|
while x < 100:
|
2013-12-29 17:34:42 -05:00
|
|
|
d[x] = x
|
|
|
|
x += 1
|
2016-02-12 18:38:30 -05:00
|
|
|
print(d[50])
|