forked from techstay/python-study
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter5.py
More file actions
36 lines (24 loc) · 461 Bytes
/
chapter5.py
File metadata and controls
36 lines (24 loc) · 461 Bytes
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
# Q1
import zoo
zoo.hours()
# Q2
import zoo as menagerie
menagerie.hours()
# Q3
from zoo import hours
hours()
# Q4
from zoo import hours as info
info()
# Q5
plain = {'a': 1, 'b': 2, 'c': 3}
print(plain)
# Q6
from collections import OrderedDict
fancy = OrderedDict([('a', 1), ('b', 2), ('c', 3)])
print(fancy)
# Q7
from collections import defaultdict
dict_of_lists = defaultdict(list)
dict_of_lists['a'] = 'something for a'
print(dict_of_lists['a'])