File tree Expand file tree Collapse file tree
07-09-data-structures/code Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "cells" : [
3+ {
4+ "cell_type" : " code" ,
5+ "execution_count" : 7 ,
6+ "metadata" : {},
7+ "outputs" : [],
8+ "source" : [
9+ " from collections import defaultdict, namedtuple, Counter, deque"
10+ ]
11+ },
12+ {
13+ "cell_type" : " code" ,
14+ "execution_count" : 10 ,
15+ "metadata" : {},
16+ "outputs" : [],
17+ "source" : [
18+ " User = namedtuple('User', 'name role')"
19+ ]
20+ },
21+ {
22+ "cell_type" : " code" ,
23+ "execution_count" : 11 ,
24+ "metadata" : {},
25+ "outputs" : [],
26+ "source" : [
27+ " user = User(name='Ian', role='Quantity Surveyor')"
28+ ]
29+ },
30+ {
31+ "cell_type" : " code" ,
32+ "execution_count" : 12 ,
33+ "metadata" : {},
34+ "outputs" : [
35+ {
36+ "data" : {
37+ "text/plain" : [
38+ " 'Ian'"
39+ ]
40+ },
41+ "execution_count" : 12 ,
42+ "metadata" : {},
43+ "output_type" : " execute_result"
44+ }
45+ ],
46+ "source" : [
47+ " user.name"
48+ ]
49+ },
50+ {
51+ "cell_type" : " code" ,
52+ "execution_count" : 13 ,
53+ "metadata" : {},
54+ "outputs" : [
55+ {
56+ "data" : {
57+ "text/plain" : [
58+ " 'Quantity Surveyor'"
59+ ]
60+ },
61+ "execution_count" : 13 ,
62+ "metadata" : {},
63+ "output_type" : " execute_result"
64+ }
65+ ],
66+ "source" : [
67+ " user.role"
68+ ]
69+ },
70+ {
71+ "cell_type" : " code" ,
72+ "execution_count" : 14 ,
73+ "metadata" : {},
74+ "outputs" : [
75+ {
76+ "data" : {
77+ "text/plain" : [
78+ " User(name='Ian', role='Quantity Surveyor')"
79+ ]
80+ },
81+ "execution_count" : 14 ,
82+ "metadata" : {},
83+ "output_type" : " execute_result"
84+ }
85+ ],
86+ "source" : [
87+ " user"
88+ ]
89+ },
90+ {
91+ "cell_type" : " code" ,
92+ "execution_count" : null ,
93+ "metadata" : {},
94+ "outputs" : [],
95+ "source" : []
96+ }
97+ ],
98+ "metadata" : {
99+ "kernelspec" : {
100+ "display_name" : " Python 3" ,
101+ "language" : " python" ,
102+ "name" : " python3"
103+ },
104+ "language_info" : {
105+ "codemirror_mode" : {
106+ "name" : " ipython" ,
107+ "version" : 3
108+ },
109+ "file_extension" : " .py" ,
110+ "mimetype" : " text/x-python" ,
111+ "name" : " python" ,
112+ "nbconvert_exporter" : " python" ,
113+ "pygments_lexer" : " ipython3" ,
114+ "version" : " 3.6.5"
115+ }
116+ },
117+ "nbformat" : 4 ,
118+ "nbformat_minor" : 2
119+ }
Original file line number Diff line number Diff line change 5656 },
5757 {
5858 "cell_type" : " code" ,
59- "execution_count" : 2 ,
59+ "execution_count" : 7 ,
6060 "metadata" : {},
6161 "outputs" : [],
6262 "source" : [
7272 },
7373 {
7474 "cell_type" : " code" ,
75- "execution_count" : 3 ,
75+ "execution_count" : 8 ,
7676 "metadata" : {},
7777 "outputs" : [
7878 {
8181 " 'bob is a coder'"
8282 ]
8383 },
84- "execution_count" : 3 ,
84+ "execution_count" : 8 ,
8585 "metadata" : {},
8686 "output_type" : " execute_result"
8787 }
9999 },
100100 {
101101 "cell_type" : " code" ,
102- "execution_count" : 4 ,
102+ "execution_count" : 2 ,
103103 "metadata" : {},
104104 "outputs" : [],
105105 "source" : [
115115 },
116116 {
117117 "cell_type" : " code" ,
118- "execution_count" : 5 ,
118+ "execution_count" : 3 ,
119119 "metadata" : {},
120120 "outputs" : [],
121121 "source" : [
124124 },
125125 {
126126 "cell_type" : " code" ,
127- "execution_count" : 6 ,
127+ "execution_count" : 4 ,
128128 "metadata" : {},
129129 "outputs" : [
130130 {
133133 " 'bob'"
134134 ]
135135 },
136- "execution_count" : 6 ,
136+ "execution_count" : 4 ,
137137 "metadata" : {},
138138 "output_type" : " execute_result"
139139 }
144144 },
145145 {
146146 "cell_type" : " code" ,
147- "execution_count" : 7 ,
147+ "execution_count" : 12 ,
148148 "metadata" : {},
149149 "outputs" : [
150150 {
153153 " 'coder'"
154154 ]
155155 },
156- "execution_count" : 7 ,
156+ "execution_count" : 12 ,
157157 "metadata" : {},
158158 "output_type" : " execute_result"
159159 }
171171 },
172172 {
173173 "cell_type" : " code" ,
174- "execution_count" : 8 ,
174+ "execution_count" : 13 ,
175175 "metadata" : {},
176176 "outputs" : [
177177 {
180180 " 'bob is a coder'"
181181 ]
182182 },
183- "execution_count" : 8 ,
183+ "execution_count" : 13 ,
184184 "metadata" : {},
185185 "output_type" : " execute_result"
186186 }
805805 "name" : " python" ,
806806 "nbconvert_exporter" : " python" ,
807807 "pygments_lexer" : " ipython3" ,
808- "version" : " 3.6.1 "
808+ "version" : " 3.6.5 "
809809 }
810810 },
811811 "nbformat" : 4 ,
You can’t perform that action at this time.
0 commit comments