Skip to content

Commit 9441475

Browse files
add live demo to readme file, change the intro to be even more accessible, add more practice to loops and logic
1 parent 970c05d commit 9441475

File tree

3 files changed

+190
-237
lines changed

3 files changed

+190
-237
lines changed

Intro_To_Python.ipynb

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,26 @@
5555
"cell_type": "code",
5656
"outputs": [],
5757
"execution_count": null,
58-
"source": "# write a print statement here and run it",
58+
"source": "# write a print statement below and run it\n",
5959
"id": "1f40c56b228dc899"
6060
},
61+
{
62+
"metadata": {},
63+
"cell_type": "markdown",
64+
"source": "Here's the thing though, when you want to print a number, you need to make sure that you're telling Python how to interpret what you're giving it. Python needs you to tell it what's text, and what's a number. Below are a few different examples. If you put something in quotes, that means it's text. If you put something without quotes, that means you're commanding Python to do something.",
65+
"id": "7305b807d0f19107"
66+
},
67+
{
68+
"metadata": {},
69+
"cell_type": "code",
70+
"outputs": [],
71+
"execution_count": null,
72+
"source": [
73+
"print(2 + 2) # this is a number\n",
74+
"print(\"2 + 2\") # this is text"
75+
],
76+
"id": "fa6a745b4962d6e3"
77+
},
6178
{
6279
"metadata": {},
6380
"cell_type": "markdown",
@@ -69,7 +86,7 @@
6986
"cell_type": "code",
7087
"outputs": [],
7188
"execution_count": null,
72-
"source": "# try printing it out here",
89+
"source": "# try printing it out below\n",
7390
"id": "f491bccb1ea66088"
7491
},
7592
{
@@ -219,8 +236,8 @@
219236
{
220237
"metadata": {
221238
"ExecuteTime": {
222-
"end_time": "2025-09-19T16:17:06.845303Z",
223-
"start_time": "2025-09-19T16:17:06.612175Z"
239+
"end_time": "2025-09-22T17:21:18.199693Z",
240+
"start_time": "2025-09-22T17:21:18.190563Z"
224241
}
225242
},
226243
"cell_type": "code",
@@ -236,18 +253,8 @@
236253
"name": "stdout",
237254
"output_type": "stream",
238255
"text": [
239-
"5\n"
240-
]
241-
},
242-
{
243-
"ename": "TypeError",
244-
"evalue": "can only concatenate str (not \"float\") to str",
245-
"output_type": "error",
246-
"traceback": [
247-
"\u001B[31m---------------------------------------------------------------------------\u001B[39m",
248-
"\u001B[31mTypeError\u001B[39m Traceback (most recent call last)",
249-
"\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[1]\u001B[39m\u001B[32m, line 4\u001B[39m\n\u001B[32m 2\u001B[39m \u001B[38;5;28mprint\u001B[39m(x)\n\u001B[32m 3\u001B[39m pi = \u001B[32m3.1415962\u001B[39m\n\u001B[32m----> \u001B[39m\u001B[32m4\u001B[39m \u001B[38;5;28mprint\u001B[39m(\u001B[33;43m\"\u001B[39;49m\u001B[33;43mI love \u001B[39;49m\u001B[33;43m\"\u001B[39;49m\u001B[43m \u001B[49m\u001B[43m+\u001B[49m\u001B[43m \u001B[49m\u001B[43mpi\u001B[49m)\n",
250-
"\u001B[31mTypeError\u001B[39m: can only concatenate str (not \"float\") to str"
256+
"5\n",
257+
"I love 3.1415962\n"
251258
]
252259
}
253260
],
@@ -321,6 +328,8 @@
321328
"outputs": [],
322329
"execution_count": null,
323330
"source": [
331+
"# this is a comment and doesn't run\n",
332+
"# i can leave notes on what my code does\n",
324333
"# The following code prints out 2\n",
325334
"print (1 + 1)"
326335
],
@@ -338,6 +347,24 @@
338347
],
339348
"id": "b18a664c7e3bdf06"
340349
},
350+
{
351+
"metadata": {},
352+
"cell_type": "markdown",
353+
"source": "Try writing a comment to explain what the code below does",
354+
"id": "b42f5ed82e7a36ff"
355+
},
356+
{
357+
"metadata": {},
358+
"cell_type": "code",
359+
"outputs": [],
360+
"execution_count": null,
361+
"source": [
362+
"cheese = 3\n",
363+
"if cheese * 2 > 3:\n",
364+
" print(\"that's a lot of cheese!\")"
365+
],
366+
"id": "950d531874ef341a"
367+
},
341368
{
342369
"metadata": {},
343370
"cell_type": "markdown",

0 commit comments

Comments
 (0)