Skip to content

Commit ab56d13

Browse files
authored
Begin Python
1 parent 4221c52 commit ab56d13

11 files changed

+98
-494
lines changed

01. Overview.ipynb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,9 @@
4545
},
4646
{
4747
"cell_type": "code",
48-
"execution_count": 3,
48+
"execution_count": null,
4949
"metadata": {},
50-
"outputs": [
51-
{
52-
"name": "stdout",
53-
"output_type": "stream",
54-
"text": [
55-
"TCLab version 0.4.9\n",
56-
"Arduino Leonardo connected on port COM9 at 115200 baud.\n",
57-
"TCLab Firmware Version 1.01.\n",
58-
"TCLab disconnected successfully.\n"
59-
]
60-
}
61-
],
50+
"outputs": [],
6251
"source": [
6352
"# install tclab\n",
6453
"try:\n",

02. Debugging.ipynb

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,57 +27,27 @@
2727
},
2828
{
2929
"cell_type": "code",
30-
"execution_count": 9,
30+
"execution_count": null,
3131
"metadata": {},
32-
"outputs": [
33-
{
34-
"ename": "SyntaxError",
35-
"evalue": "invalid syntax (<ipython-input-9-7d7d53e578fa>, line 1)",
36-
"output_type": "error",
37-
"traceback": [
38-
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-9-7d7d53e578fa>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m print('Program to Hatch an Egg) # hint: look for a missing ' character\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
39-
]
40-
}
41-
],
32+
"outputs": [],
4233
"source": [
4334
"print('Program to Hatch an Egg) # hint: look for a missing ' character"
4435
]
4536
},
4637
{
4738
"cell_type": "code",
48-
"execution_count": 8,
39+
"execution_count": null,
4940
"metadata": {},
50-
"outputs": [
51-
{
52-
"ename": "SyntaxError",
53-
"evalue": "invalid syntax (<ipython-input-8-afaacfd12f22>, line 1)",
54-
"output_type": "error",
55-
"traceback": [
56-
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-8-afaacfd12f22>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m target temperature = 37 # hint: variable names cannot have spaces\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
57-
]
58-
}
59-
],
41+
"outputs": [],
6042
"source": [
6143
"target temperature = 37 # hint: variable names cannot have spaces"
6244
]
6345
},
6446
{
6547
"cell_type": "code",
66-
"execution_count": 7,
48+
"execution_count": null,
6749
"metadata": {},
68-
"outputs": [
69-
{
70-
"ename": "TypeError",
71-
"evalue": "unsupported operand type(s) for +: 'int' and 'str'",
72-
"output_type": "error",
73-
"traceback": [
74-
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
75-
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
76-
"\u001b[1;32m<ipython-input-7-0c5f3e537629>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0mtarget_temperature\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m37\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[0mdifference\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtarget_temperature\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mcurrent_temperature\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdifference\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m'degC'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
77-
"\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'int' and 'str'"
78-
]
79-
}
80-
],
50+
"outputs": [],
8151
"source": [
8252
"current_temperature = 30\n",
8353
"target_temperature = 37\n",

03. Variables.ipynb

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
{
2626
"cell_type": "code",
27-
"execution_count": 6,
27+
"execution_count": null,
2828
"metadata": {},
2929
"outputs": [],
3030
"source": [
@@ -143,20 +143,9 @@
143143
},
144144
{
145145
"cell_type": "code",
146-
"execution_count": 8,
146+
"execution_count": null,
147147
"metadata": {},
148-
"outputs": [
149-
{
150-
"data": {
151-
"text/plain": [
152-
"str"
153-
]
154-
},
155-
"execution_count": 8,
156-
"metadata": {},
157-
"output_type": "execute_result"
158-
}
159-
],
148+
"outputs": [],
160149
"source": [
161150
"test = 3\n",
162151
"test = \"egg\"\n",
@@ -186,26 +175,17 @@
186175
"cell_type": "markdown",
187176
"metadata": {},
188177
"source": [
189-
"## Activity\n",
178+
"### Activity\n",
190179
"Make one variable for every variable type, string, integer, float, and boolean.\n",
191180
"\n",
192181
"(The ```#``` symbol makes the text behind it a comment. Those words are just for discribing the program, they don't do anything to the code.)"
193182
]
194183
},
195184
{
196185
"cell_type": "code",
197-
"execution_count": 9,
186+
"execution_count": null,
198187
"metadata": {},
199-
"outputs": [
200-
{
201-
"ename": "SyntaxError",
202-
"evalue": "invalid syntax (<ipython-input-9-480f02309b9f>, line 1)",
203-
"output_type": "error",
204-
"traceback": [
205-
"\u001b[1;36m File \u001b[1;32m\"<ipython-input-9-480f02309b9f>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m string =\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
206-
]
207-
}
208-
],
188+
"outputs": [],
209189
"source": [
210190
"string = \n",
211191
"integer = \n",

04. Printing.ipynb

Lines changed: 13 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": null,
1515
"metadata": {},
16-
"outputs": [
17-
{
18-
"name": "stdout",
19-
"output_type": "stream",
20-
"text": [
21-
"Chicken Hatches: 'Hello World!'\n"
22-
]
23-
}
24-
],
16+
"outputs": [],
2517
"source": [
2618
"print(\"Chicken Hatches: 'Hello World!'\") # Put something in between the \"\" symbols"
2719
]
@@ -35,19 +27,9 @@
3527
},
3628
{
3729
"cell_type": "code",
38-
"execution_count": 11,
30+
"execution_count": null,
3931
"metadata": {},
40-
"outputs": [
41-
{
42-
"name": "stdout",
43-
"output_type": "stream",
44-
"text": [
45-
"<class 'int'>\n",
46-
"<class 'str'>\n",
47-
"<class 'bool'>\n"
48-
]
49-
}
50-
],
32+
"outputs": [],
5133
"source": [
5234
"eggs = 200 # integer variable\n",
5335
"print(type(eggs))\n",
@@ -102,17 +84,9 @@
10284
},
10385
{
10486
"cell_type": "code",
105-
"execution_count": 6,
87+
"execution_count": null,
10688
"metadata": {},
107-
"outputs": [
108-
{
109-
"name": "stdout",
110-
"output_type": "stream",
111-
"text": [
112-
"You are cooking the egg at 45 °C, cool down!\n"
113-
]
114-
}
115-
],
89+
"outputs": [],
11690
"source": [
11791
"var1 = \"You are cooking the egg at\"\n",
11892
"var2 = 45\n",
@@ -129,22 +103,11 @@
129103
},
130104
{
131105
"cell_type": "code",
132-
"execution_count": 7,
106+
"execution_count": null,
133107
"metadata": {
134108
"scrolled": true
135109
},
136-
"outputs": [
137-
{
138-
"data": {
139-
"text/plain": [
140-
"10"
141-
]
142-
},
143-
"execution_count": 7,
144-
"metadata": {},
145-
"output_type": "execute_result"
146-
}
147-
],
110+
"outputs": [],
148111
"source": [
149112
"5*2"
150113
]
@@ -158,19 +121,9 @@
158121
},
159122
{
160123
"cell_type": "code",
161-
"execution_count": 8,
124+
"execution_count": null,
162125
"metadata": {},
163-
"outputs": [
164-
{
165-
"name": "stdout",
166-
"output_type": "stream",
167-
"text": [
168-
"7.0\n",
169-
"14\n",
170-
"14\n"
171-
]
172-
}
173-
],
126+
"outputs": [],
174127
"source": [
175128
"print(14/2)\n",
176129
"print(7*2)\n",
@@ -211,7 +164,7 @@
211164
},
212165
{
213166
"cell_type": "code",
214-
"execution_count": 12,
167+
"execution_count": null,
215168
"metadata": {},
216169
"outputs": [],
217170
"source": [
@@ -230,17 +183,9 @@
230183
},
231184
{
232185
"cell_type": "code",
233-
"execution_count": 9,
186+
"execution_count": null,
234187
"metadata": {},
235-
"outputs": [
236-
{
237-
"name": "stdout",
238-
"output_type": "stream",
239-
"text": [
240-
"100\n"
241-
]
242-
}
243-
],
188+
"outputs": [],
244189
"source": [
245190
"equation = 25*4\n",
246191
"print(equation ) # Make an equation to equal 500"

05. Classes and Objects.ipynb

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 5,
67+
"execution_count": null,
6868
"metadata": {},
6969
"outputs": [],
7070
"source": [
@@ -95,20 +95,9 @@
9595
},
9696
{
9797
"cell_type": "code",
98-
"execution_count": 3,
98+
"execution_count": null,
9999
"metadata": {},
100-
"outputs": [
101-
{
102-
"name": "stdout",
103-
"output_type": "stream",
104-
"text": [
105-
"TCLab version 0.4.9\n",
106-
"Arduino Leonardo connected on port COM9 at 115200 baud.\n",
107-
"TCLab Firmware Version 1.01.\n",
108-
"TCLab disconnected successfully.\n"
109-
]
110-
}
111-
],
100+
"outputs": [],
112101
"source": [
113102
"import tclab # Imported Package\n",
114103
"lab = tclab.TCLab() # Object that connects with the kit\n",
@@ -143,42 +132,9 @@
143132
},
144133
{
145134
"cell_type": "code",
146-
"execution_count": 2,
135+
"execution_count": null,
147136
"metadata": {},
148-
"outputs": [
149-
{
150-
"name": "stdout",
151-
"output_type": "stream",
152-
"text": [
153-
"TCLab version 0.4.9\n",
154-
"Arduino Leonardo connected on port COM9 at 115200 baud.\n",
155-
"TCLab Firmware Version 1.01.\n",
156-
"Turn on heaters for 20 seconds\n",
157-
"Time: 0 T1: 18.64 T2: 18.74\n",
158-
"Time: 1 T1: 18.64 T2: 18.87\n",
159-
"Time: 2 T1: 18.61 T2: 18.84\n",
160-
"Time: 3 T1: 18.71 T2: 18.64\n",
161-
"Time: 4 T1: 18.64 T2: 18.87\n",
162-
"Time: 5 T1: 18.64 T2: 18.87\n",
163-
"Time: 6 T1: 18.67 T2: 18.87\n",
164-
"Time: 7 T1: 18.8 T2: 18.77\n",
165-
"Time: 8 T1: 18.96 T2: 18.84\n",
166-
"Time: 9 T1: 18.96 T2: 18.64\n",
167-
"Time: 10 T1: 18.96 T2: 18.93\n",
168-
"Time: 11 T1: 19.19 T2: 19.09\n",
169-
"Time: 12 T1: 19.25 T2: 19.13\n",
170-
"Time: 13 T1: 19.29 T2: 19.16\n",
171-
"Time: 14 T1: 19.42 T2: 19.16\n",
172-
"Time: 15 T1: 19.61 T2: 19.16\n",
173-
"Time: 16 T1: 19.74 T2: 19.25\n",
174-
"Time: 17 T1: 19.93 T2: 19.35\n",
175-
"Time: 18 T1: 19.93 T2: 19.38\n",
176-
"Time: 19 T1: 20.22 T2: 19.48\n",
177-
"Time: 20 T1: 20.29 T2: 19.48\n",
178-
"TCLab disconnected successfully.\n"
179-
]
180-
}
181-
],
137+
"outputs": [],
182138
"source": [
183139
"import tclab\n",
184140
"import time\n",

0 commit comments

Comments
 (0)