|
8 | 8 | } |
9 | 9 | }, |
10 | 10 | "source": [ |
11 | | - "# Absolute Beginner Module 1 Introduction (P1M1)\n", |
| 11 | + "# Python Absolute Beginner Module 1: Introduction (P1M1)\n", |
12 | 12 | "## Getting started with Python in Jupyter Notebooks\n", |
13 | 13 | "- **Python 3 in Jupyter notebooks**\n", |
14 | 14 | "- **`print()`**\n", |
|
38 | 38 | "Python has a very simple implementation: \n", |
39 | 39 | "```python\n", |
40 | 40 | "print(\"Hello World!\")\n", |
41 | | - "``` " |
| 41 | + "``` \n", |
| 42 | + "\n", |
| 43 | + "# Watch this video walkthrough as you work\n", |
| 44 | + "## The big green circle play icon below links to a video walkthrough of this tutorial\n", |
| 45 | + "When you see a video walkthrough in the tutorials, click on it and watch it as you work to have a guided lesson on how to complete the tasks and learn the materials. This walkthrough covers tasks 1-5.\n", |
| 46 | + "[](https://youtu.be/iPU4aJEylEA)" |
42 | 47 | ] |
43 | 48 | }, |
44 | 49 | { |
|
80 | 85 | }, |
81 | 86 | { |
82 | 87 | "cell_type": "code", |
83 | | - "execution_count": null, |
| 88 | + "execution_count": 1, |
84 | 89 | "metadata": { |
85 | 90 | "slideshow": { |
86 | 91 | "slide_type": "subslide" |
87 | 92 | } |
88 | 93 | }, |
89 | | - "outputs": [], |
| 94 | + "outputs": [ |
| 95 | + { |
| 96 | + "name": "stdout", |
| 97 | + "output_type": "stream", |
| 98 | + "text": [ |
| 99 | + "Hello World!\n" |
| 100 | + ] |
| 101 | + } |
| 102 | + ], |
90 | 103 | "source": [ |
91 | 104 | "# Review the code, run the code\n", |
92 | 105 | "print(\"Hello World!\")" |
93 | 106 | ] |
94 | 107 | }, |
95 | 108 | { |
96 | 109 | "cell_type": "code", |
97 | | - "execution_count": null, |
| 110 | + "execution_count": 3, |
98 | 111 | "metadata": {}, |
99 | | - "outputs": [], |
100 | | - "source": [] |
| 112 | + "outputs": [ |
| 113 | + { |
| 114 | + "name": "stdout", |
| 115 | + "output_type": "stream", |
| 116 | + "text": [ |
| 117 | + "Hello programmer!\n" |
| 118 | + ] |
| 119 | + } |
| 120 | + ], |
| 121 | + "source": [ |
| 122 | + "print(\"Hello programmer!\")" |
| 123 | + ] |
101 | 124 | }, |
102 | 125 | { |
103 | 126 | "cell_type": "code", |
|
133 | 156 | }, |
134 | 157 | { |
135 | 158 | "cell_type": "code", |
136 | | - "execution_count": null, |
| 159 | + "execution_count": 5, |
137 | 160 | "metadata": {}, |
138 | 161 | "outputs": [], |
139 | 162 | "source": [ |
140 | 163 | "# this is how a comment looks in python code\n", |
141 | | - "# every comment line starts with the # symbol" |
| 164 | + "# every comment line starts with the # symbol\n", |
| 165 | + "# print(\"hello world\")" |
142 | 166 | ] |
143 | 167 | }, |
144 | 168 | { |
|
230 | 254 | "outputs": [], |
231 | 255 | "source": [] |
232 | 256 | }, |
| 257 | + { |
| 258 | + "cell_type": "code", |
| 259 | + "execution_count": null, |
| 260 | + "metadata": {}, |
| 261 | + "outputs": [], |
| 262 | + "source": [] |
| 263 | + }, |
| 264 | + { |
| 265 | + "cell_type": "code", |
| 266 | + "execution_count": null, |
| 267 | + "metadata": {}, |
| 268 | + "outputs": [], |
| 269 | + "source": [] |
| 270 | + }, |
233 | 271 | { |
234 | 272 | "cell_type": "markdown", |
235 | 273 | "metadata": {}, |
|
293 | 331 | "## What is a **String?** \n", |
294 | 332 | "Strings were used in \"Hello World!\" print function examples. Strings are sets of characters. In Python strings are in double or single quotes like `\"Hello World!\"` or `'after edit, save!'` \n", |
295 | 333 | " \n", |
296 | | - "A String is a common **type** of data, used in programming, consisting of a sequence of 1 or more characters. They are known formally as a primitive data type. \n", |
| 334 | + "A String is a common **type** of data, used in programming, consisting of a sequence of 1 or more characters. They are known formally as a **primitive data type.** The other primitive types are integer, float, and boolean. We will see those later.\n", |
297 | 335 | "* **A String is a sequence of characters** (aka: a *string* of characters) \n", |
298 | 336 | " * Character examples: `A, B, C, a, b, c, 1, 2, 3, !, &`\n", |
299 | 337 | "* A String in Python is contained in quotes, single(') or double(\")\n", |
|
313 | 351 | }, |
314 | 352 | { |
315 | 353 | "cell_type": "code", |
316 | | - "execution_count": null, |
| 354 | + "execution_count": 6, |
317 | 355 | "metadata": {}, |
318 | | - "outputs": [], |
| 356 | + "outputs": [ |
| 357 | + { |
| 358 | + "name": "stdout", |
| 359 | + "output_type": "stream", |
| 360 | + "text": [ |
| 361 | + "strings go in single\n", |
| 362 | + "or double quotes\n" |
| 363 | + ] |
| 364 | + } |
| 365 | + ], |
319 | 366 | "source": [ |
320 | 367 | "# examples of printing strings with single and double quotes\n", |
321 | 368 | "print('strings go in single')\n", |
|
368 | 415 | }, |
369 | 416 | { |
370 | 417 | "cell_type": "code", |
371 | | - "execution_count": null, |
| 418 | + "execution_count": 7, |
372 | 419 | "metadata": {}, |
373 | | - "outputs": [], |
374 | | - "source": [] |
| 420 | + "outputs": [ |
| 421 | + { |
| 422 | + "name": "stdout", |
| 423 | + "output_type": "stream", |
| 424 | + "text": [ |
| 425 | + "123\n", |
| 426 | + "123\n" |
| 427 | + ] |
| 428 | + } |
| 429 | + ], |
| 430 | + "source": [ |
| 431 | + "print(123) #integer, with numeric value\n", |
| 432 | + "print(\"123\") #string, represents text characters" |
| 433 | + ] |
375 | 434 | }, |
376 | 435 | { |
377 | 436 | "cell_type": "markdown", |
|
384 | 443 | "source": [ |
385 | 444 | "# \n", |
386 | 445 | "<font size=\"6\" color=\"#00A0B2\" face=\"verdana\"> <B>Concepts</B></font>\n", |
387 | | - "## Integers are another type\n", |
| 446 | + "## Integers are another primitive data type\n", |
388 | 447 | "- whole numbers such as `-2, -1, 0, 1, 2, 3` are Integers \n", |
389 | 448 | "- Integers are **not placed in quotes** \n", |
390 | 449 | " \n", |
|
406 | 465 | }, |
407 | 466 | { |
408 | 467 | "cell_type": "code", |
409 | | - "execution_count": null, |
| 468 | + "execution_count": 8, |
410 | 469 | "metadata": {}, |
411 | | - "outputs": [], |
| 470 | + "outputs": [ |
| 471 | + { |
| 472 | + "name": "stdout", |
| 473 | + "output_type": "stream", |
| 474 | + "text": [ |
| 475 | + "299\n", |
| 476 | + "2017\n" |
| 477 | + ] |
| 478 | + } |
| 479 | + ], |
412 | 480 | "source": [ |
413 | 481 | "# printing an Integer with python\n", |
414 | 482 | "print(299)\n", |
|
454 | 522 | "source": [ |
455 | 523 | "# \n", |
456 | 524 | "<font size=\"6\" color=\"#00A0B2\" face=\"verdana\"> <B>Concepts</B></font>\n", |
457 | | - "## Variables & Storing Strings in **Variables** \n", |
| 525 | + "## Variables & Storing Data in **Variables** \n", |
458 | 526 | "### Variables are named containers\n", |
459 | 527 | "Computer programs often create storage for things that are used in repeated processing like item_price, student_name, stock_symbol. In python a variable is a type of **object** that can be addressed by name to access the assigned contents.\n", |
460 | 528 | "\n", |
461 | | - "#### Name a variable staring with a letter or underscore \"_\"\n", |
| 529 | + "#### Name a variable staring with a letter or underscore \"_\"; You cannot begin the name with a number or reserved word\n", |
462 | 530 | "There are different styles for creating variables this course uses lowercase descriptive names connected by underscores:\n", |
463 | 531 | "- item_price\n", |
464 | 532 | "- student_name\n", |
|
494 | 562 | }, |
495 | 563 | { |
496 | 564 | "cell_type": "code", |
497 | | - "execution_count": null, |
| 565 | + "execution_count": 12, |
498 | 566 | "metadata": {}, |
499 | | - "outputs": [], |
| 567 | + "outputs": [ |
| 568 | + { |
| 569 | + "name": "stdout", |
| 570 | + "output_type": "stream", |
| 571 | + "text": [ |
| 572 | + "I am a string\n", |
| 573 | + "Run this cell using Ctrl+Enter\n" |
| 574 | + ] |
| 575 | + } |
| 576 | + ], |
500 | 577 | "source": [ |
501 | 578 | "# [ ] Review code and Run\n", |
502 | 579 | "# initialize the variable\n", |
503 | | - "current_msg = \"I am a string\"\n", |
| 580 | + "#current_msg = \"I am a string\"\n", |
504 | 581 | "\n", |
505 | 582 | "# print literal string\n", |
506 | 583 | "print(\"I am a string\")\n", |
|
511 | 588 | }, |
512 | 589 | { |
513 | 590 | "cell_type": "code", |
514 | | - "execution_count": null, |
| 591 | + "execution_count": 11, |
515 | 592 | "metadata": { |
516 | 593 | "scrolled": true |
517 | 594 | }, |
518 | | - "outputs": [], |
| 595 | + "outputs": [ |
| 596 | + { |
| 597 | + "name": "stdout", |
| 598 | + "output_type": "stream", |
| 599 | + "text": [ |
| 600 | + "Run this cell using Ctrl+Enter\n" |
| 601 | + ] |
| 602 | + } |
| 603 | + ], |
519 | 604 | "source": [ |
520 | 605 | "# [ ] Review code and Run\n", |
521 | 606 | "# assign a new string to the current_msg\n", |
|
575 | 660 | "student_name =\"Dias, Joana\" #student_name initialized as a string\n", |
576 | 661 | "license_plate = \"123A\" #license_plate initialized as a string\n", |
577 | 662 | "```\n", |
578 | | - "\n", |
| 663 | + "# Walkthrough video for tasks 6-12\n", |
| 664 | + "[](https://youtu.be/y59XBWNTM_Y)\n", |
579 | 665 | "\n", |
580 | 666 | "### Variables can start initialized as an Integer number data type \n", |
581 | 667 | ">```python \n", |
|
758 | 844 | "#### What does using `type()` reveal?\n", |
759 | 845 | "- **`str`**: when **type()** returns **str** that means it has evaluated a **string** characters (numbers, letters, punctuation...) in quotes \n", |
760 | 846 | "- **`int`**: when **type()** returns **int** that means it has evaluated an **Integer** (+/- whole numbers) \n", |
761 | | - "- **`float`**: when **type()** returns **`float`** that means it has evaluated decimal numbers (e.g. 3.33, 0.01, 9.9999 and 3.0), ...more later in the course" |
| 847 | + "- **`float`**: when **type()** returns **`float`** that means it has evaluated decimal numbers (e.g. 3.33, 0.01, 9.9999 and 3.0), ...more later in the course\n" |
762 | 848 | ] |
763 | 849 | }, |
764 | 850 | { |
|
1166 | 1252 | "metadata": {}, |
1167 | 1253 | "outputs": [], |
1168 | 1254 | "source": [ |
1169 | | - "# [ ] perform Integer addition in the variable named new_msg (add 2 or more Integers)\n", |
| 1255 | + "# [ ] perform Integer addition in the variable named new_sum (add 2 or more Integers)\n", |
1170 | 1256 | "new_sum = 0\n", |
1171 | 1257 | "print(new_sum)\n", |
1172 | 1258 | "\n", |
|
1586 | 1672 | "\n", |
1587 | 1673 | "## input() \n", |
1588 | 1674 | "### get information from users with `input()` \n", |
1589 | | - "the **`input()`** function prompts the user to supply data returning that data as a string" |
| 1675 | + "the **`input()`** function prompts the user to supply data returning that data as a string\n", |
| 1676 | + "\n", |
| 1677 | + "# Walkthrough video for the rest of module 1\n", |
| 1678 | + "[](https://youtu.be/wAdtOA5pld0)" |
1590 | 1679 | ] |
1591 | 1680 | }, |
1592 | 1681 | { |
|
2168 | 2257 | "collapsed": true |
2169 | 2258 | }, |
2170 | 2259 | "source": [ |
2171 | | - "# Module 1 Part 9\n", |
| 2260 | + "# Module 1 Part 9 - Same items as M1 P8 but iterate, change them\n", |
2172 | 2261 | "## Strings: input, testing, formatting\n", |
2173 | 2262 | "- input() - gathering user input \n", |
2174 | 2263 | "- **print() formatting** \n", |
|
2654 | 2743 | "collapsed": true |
2655 | 2744 | }, |
2656 | 2745 | "source": [ |
2657 | | - "# Module 1 Part 11\n", |
| 2746 | + "# Module 1 Part 11 - Same items as M1 P10, iterate, try something new\n", |
2658 | 2747 | "## Strings: input, testing, formatting\n", |
2659 | 2748 | "- input() - gathering user input \n", |
2660 | 2749 | "- print() formatting \n", |
|
0 commit comments