|
20 | 20 | "\n",
|
21 | 21 | "1. **Setting up GitHub Account.** If you want to learn more about how to work with GitHub and how GitHub internally works, we recommend you to take a look to [The curious coder’s guide to git](https://matthew-brett.github.io/curious-git/). After we all have a GitHub account, we will ask you to complete this [form](https://docs.google.com/forms/d/1LMPPklVx6l7qdcBppK0jxpBWJv-95imkCMoaZxjl6_A/edit) so we can add you to GitHub Classroom. \n",
|
22 | 22 | "\n",
|
23 |
| - "1. **Warming up with Python.** We will follow the Python tutorial wrote by Jake VanderPlas, [A Whirlwind Tour of Python](https://jakevdp.github.io/WhirlwindTourOfPython/).\n", |
| 23 | + "1. **Warming up with Python.** We will follow the Python tutorial written by Jake VanderPlas, [A Whirlwind Tour of Python](https://jakevdp.github.io/WhirlwindTourOfPython).\n", |
24 | 24 | " \n",
|
25 | 25 | "1. **Debugging in Python/iPython.**\n",
|
26 | 26 | " 1. Debuggin with [pdb](https://docs.python.org/3/library/pdb.html) \n",
|
|
34 | 34 | "- Interpreted instead of compiled\n",
|
35 | 35 | "- Clean syntax\n",
|
36 | 36 | "- Object oriented (attributes + methods), convenient language constructs\n",
|
37 |
| - "- Variables are pointers (speed and memory efficient)" |
38 |
| - ] |
39 |
| - }, |
40 |
| - { |
41 |
| - "cell_type": "code", |
42 |
| - "execution_count": 46, |
43 |
| - "id": "de3d095b-813e-4fa1-8fdf-e4741f9a44e0", |
44 |
| - "metadata": {}, |
45 |
| - "outputs": [ |
46 |
| - { |
47 |
| - "name": "stdout", |
48 |
| - "output_type": "stream", |
49 |
| - "text": [ |
50 |
| - "171\n" |
51 |
| - ] |
52 |
| - } |
53 |
| - ], |
54 |
| - "source": [ |
55 |
| - "import sys\n", |
56 |
| - "\n", |
57 |
| - "print(sys.getrefcount(255))" |
58 |
| - ] |
59 |
| - }, |
60 |
| - { |
61 |
| - "cell_type": "code", |
62 |
| - "execution_count": 48, |
63 |
| - "id": "23946485-73ed-44fd-929e-371ba5de4a55", |
64 |
| - "metadata": {}, |
65 |
| - "outputs": [], |
66 |
| - "source": [ |
67 |
| - "x1 = 255" |
68 |
| - ] |
69 |
| - }, |
70 |
| - { |
71 |
| - "cell_type": "code", |
72 |
| - "execution_count": 49, |
73 |
| - "id": "300b5087-477e-464c-a66c-1d68b3e70815", |
74 |
| - "metadata": {}, |
75 |
| - "outputs": [ |
76 |
| - { |
77 |
| - "name": "stdout", |
78 |
| - "output_type": "stream", |
79 |
| - "text": [ |
80 |
| - "172\n" |
81 |
| - ] |
82 |
| - } |
83 |
| - ], |
84 |
| - "source": [ |
85 |
| - "print(sys.getrefcount(255))" |
| 37 | + "- Variables can access large data structures by reference, without making a copy (speed and memory efficient)." |
86 | 38 | ]
|
87 | 39 | },
|
88 | 40 | {
|
|
119 | 71 | "\n",
|
120 | 72 | ">\n",
|
121 | 73 | "> Once you have your GitHub account, please take a few minutes to complete this form. \n",
|
122 |
| - ">" |
| 74 | + ">\n" |
123 | 75 | ]
|
124 | 76 | },
|
125 | 77 | {
|
|
172 | 124 | "metadata": {},
|
173 | 125 | "outputs": [],
|
174 | 126 | "source": [
|
175 |
| - "### .... [To do during the lab] Construct the following funtion\n", |
| 127 | + "### .... [To do during the lab] Construct the following function\n", |
176 | 128 | "\n",
|
177 | 129 | "\n",
|
178 | 130 | "from math import gcd # we import the great common divisor function from math\n",
|
|
403 | 355 | "source": [
|
404 | 356 | "### 2.2. Errors and Exceptions\n",
|
405 | 357 | "\n",
|
406 |
| - "Different kind of errors that occur as we write code include syntax, runtime and semantic errors. Specially for runtime errors, Python give us a clue about what kind or error may happened during the execution of our code. For example," |
| 358 | + "Different kinds of errors that occur as we write code include syntax, runtime and semantic errors. Specially for runtime errors, Python give us a clue about what kind or error may happened during the execution of our code. For example," |
407 | 359 | ]
|
408 | 360 | },
|
409 | 361 | {
|
|
498 | 450 | },
|
499 | 451 | {
|
500 | 452 | "cell_type": "code",
|
501 |
| - "execution_count": null, |
| 453 | + "execution_count": 1, |
502 | 454 | "id": "ca2d920e-587d-4e9e-a0ee-45da2ddbe92d",
|
503 | 455 | "metadata": {},
|
504 |
| - "outputs": [], |
| 456 | + "outputs": [ |
| 457 | + { |
| 458 | + "name": "stdout", |
| 459 | + "output_type": "stream", |
| 460 | + "text": [ |
| 461 | + "I was here\n", |
| 462 | + "Something wrong happened\n" |
| 463 | + ] |
| 464 | + } |
| 465 | + ], |
505 | 466 | "source": [
|
506 | 467 | "try:\n",
|
507 | 468 | " print(\"I was here\")\n",
|
508 | 469 | " a / b\n",
|
509 | 470 | " print(\"Was I here?\")\n",
|
510 | 471 | "except: \n",
|
511 |
| - " print(\"Something wrong happen\")" |
| 472 | + " print(\"Something wrong happened\")" |
512 | 473 | ]
|
513 | 474 | },
|
514 | 475 | {
|
|
580 | 541 | "id": "e8992735-a9c6-4656-81c4-f766362f33a2",
|
581 | 542 | "metadata": {},
|
582 | 543 | "source": [
|
583 |
| - "## 3. Debuggin in Jupyter \n", |
| 544 | + "## 3. Debugging in Jupyter \n", |
584 | 545 | "\n",
|
585 |
| - "Jupyter allow us to do post-mortem debugging with the `%debug` command. This is a basic pdb debugger." |
| 546 | + "Jupyter allow us to do post-mortem debugging with the `%debug` command. This is a wrapper around the basic [pdb debugger](https://docs.python.org/3/library/pdb.html) that ships with the Python language." |
586 | 547 | ]
|
587 | 548 | },
|
588 | 549 | {
|
|
714 | 675 | "\n",
|
715 | 676 | ">\n",
|
716 | 677 | "> *A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.*\n",
|
717 |
| - ">" |
| 678 | + ">\n" |
718 | 679 | ]
|
719 | 680 | },
|
720 | 681 | {
|
|
753 | 714 | "L2 = []"
|
754 | 715 | ]
|
755 | 716 | },
|
756 |
| - { |
757 |
| - "cell_type": "code", |
758 |
| - "execution_count": null, |
759 |
| - "id": "3e3cec38-f8f2-4cbd-a71c-f10b13072f36", |
760 |
| - "metadata": {}, |
761 |
| - "outputs": [], |
762 |
| - "source": [] |
763 |
| - }, |
764 | 717 | {
|
765 | 718 | "cell_type": "code",
|
766 | 719 | "execution_count": 60,
|
|
0 commit comments