├── 0-Math_For_MLCC.pdf ├── 1_Basic_Python.ipynb ├── 2_More_Python.ipynb └── README.md /0-Math_For_MLCC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackyRoot/MLCC_Starter_Guide/b0dc26e7aee56e699556eb6ba47861da6e5974f1/0-Math_For_MLCC.pdf -------------------------------------------------------------------------------- /1_Basic_Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "1-Basic_Python.ipynb", 7 | "version": "0.3.2", 8 | "provenance": [], 9 | "toc_visible": true, 10 | "include_colab_link": true 11 | }, 12 | "kernelspec": { 13 | "name": "python3", 14 | "display_name": "Python 3" 15 | }, 16 | "accelerator": "GPU" 17 | }, 18 | "cells": [ 19 | { 20 | "cell_type": "markdown", 21 | "metadata": { 22 | "id": "view-in-github", 23 | "colab_type": "text" 24 | }, 25 | "source": [ 26 | "[View in Colaboratory](https://colab.research.google.com/github/HackyRoot/MLCC_Starter_Guide/blob/develop/1_Basic_Python.ipynb)" 27 | ] 28 | }, 29 | { 30 | "metadata": { 31 | "id": "DNsRWCdt2dMV", 32 | "colab_type": "text" 33 | }, 34 | "cell_type": "markdown", 35 | "source": [ 36 | "# Basic Python" 37 | ] 38 | }, 39 | { 40 | "metadata": { 41 | "id": "fiFqxbnE2gt-", 42 | "colab_type": "text" 43 | }, 44 | "cell_type": "markdown", 45 | "source": [ 46 | "## Data types" 47 | ] 48 | }, 49 | { 50 | "metadata": { 51 | "id": "G5CWM4lu2kMM", 52 | "colab_type": "text" 53 | }, 54 | "cell_type": "markdown", 55 | "source": [ 56 | "### Numbers" 57 | ] 58 | }, 59 | { 60 | "metadata": { 61 | "id": "BW8YlhvZ2U7N", 62 | "colab_type": "code", 63 | "colab": { 64 | "base_uri": "https://localhost:8080/", 65 | "height": 34 66 | }, 67 | "outputId": "dec6972f-13a6-409f-9027-fbe908dce0e5" 68 | }, 69 | "cell_type": "code", 70 | "source": [ 71 | "1 + 2" 72 | ], 73 | "execution_count": 68, 74 | "outputs": [ 75 | { 76 | "output_type": "execute_result", 77 | "data": { 78 | "text/plain": [ 79 | "3" 80 | ] 81 | }, 82 | "metadata": { 83 | "tags": [] 84 | }, 85 | "execution_count": 68 86 | } 87 | ] 88 | }, 89 | { 90 | "metadata": { 91 | "id": "iB95qFOH2o-1", 92 | "colab_type": "code", 93 | "colab": { 94 | "base_uri": "https://localhost:8080/", 95 | "height": 34 96 | }, 97 | "outputId": "d6999f85-efba-4a8d-c307-397e66f96a82" 98 | }, 99 | "cell_type": "code", 100 | "source": [ 101 | "4 * 3" 102 | ], 103 | "execution_count": 69, 104 | "outputs": [ 105 | { 106 | "output_type": "execute_result", 107 | "data": { 108 | "text/plain": [ 109 | "12" 110 | ] 111 | }, 112 | "metadata": { 113 | "tags": [] 114 | }, 115 | "execution_count": 69 116 | } 117 | ] 118 | }, 119 | { 120 | "metadata": { 121 | "id": "s1mJJtj72z4U", 122 | "colab_type": "text" 123 | }, 124 | "cell_type": "markdown", 125 | "source": [ 126 | "### Variable Assignment" 127 | ] 128 | }, 129 | { 130 | "metadata": { 131 | "id": "iEU_l0E92wWJ", 132 | "colab_type": "code", 133 | "colab": {} 134 | }, 135 | "cell_type": "code", 136 | "source": [ 137 | "var_name = 5" 138 | ], 139 | "execution_count": 0, 140 | "outputs": [] 141 | }, 142 | { 143 | "metadata": { 144 | "id": "6xlu5bOX27yt", 145 | "colab_type": "code", 146 | "colab": {} 147 | }, 148 | "cell_type": "code", 149 | "source": [ 150 | "x = 1\n", 151 | "y = 5" 152 | ], 153 | "execution_count": 0, 154 | "outputs": [] 155 | }, 156 | { 157 | "metadata": { 158 | "id": "QxzT5jid3AFc", 159 | "colab_type": "code", 160 | "colab": {} 161 | }, 162 | "cell_type": "code", 163 | "source": [ 164 | "z = x + y" 165 | ], 166 | "execution_count": 0, 167 | "outputs": [] 168 | }, 169 | { 170 | "metadata": { 171 | "id": "bLiH-lb73B4M", 172 | "colab_type": "code", 173 | "colab": { 174 | "base_uri": "https://localhost:8080/", 175 | "height": 34 176 | }, 177 | "outputId": "f1f16902-ac93-4db5-e098-8f6b1e82eda9" 178 | }, 179 | "cell_type": "code", 180 | "source": [ 181 | "z" 182 | ], 183 | "execution_count": 15, 184 | "outputs": [ 185 | { 186 | "output_type": "execute_result", 187 | "data": { 188 | "text/plain": [ 189 | "6" 190 | ] 191 | }, 192 | "metadata": { 193 | "tags": [] 194 | }, 195 | "execution_count": 15 196 | } 197 | ] 198 | }, 199 | { 200 | "metadata": { 201 | "id": "ZXs13I2N3LvB", 202 | "colab_type": "text" 203 | }, 204 | "cell_type": "markdown", 205 | "source": [ 206 | "### Strings" 207 | ] 208 | }, 209 | { 210 | "metadata": { 211 | "id": "zAb43olZ3C88", 212 | "colab_type": "code", 213 | "colab": { 214 | "base_uri": "https://localhost:8080/", 215 | "height": 34 216 | }, 217 | "outputId": "a89eb6a8-4435-4124-8cf6-0bf9bf9cd453" 218 | }, 219 | "cell_type": "code", 220 | "source": [ 221 | "'Hey There' # single quotes" 222 | ], 223 | "execution_count": 16, 224 | "outputs": [ 225 | { 226 | "output_type": "execute_result", 227 | "data": { 228 | "text/plain": [ 229 | "'Hey There'" 230 | ] 231 | }, 232 | "metadata": { 233 | "tags": [] 234 | }, 235 | "execution_count": 16 236 | } 237 | ] 238 | }, 239 | { 240 | "metadata": { 241 | "id": "WJe_0O1o3FqP", 242 | "colab_type": "code", 243 | "colab": { 244 | "base_uri": "https://localhost:8080/", 245 | "height": 34 246 | }, 247 | "outputId": "46899dde-1296-4adc-f89b-8285bcc30bba" 248 | }, 249 | "cell_type": "code", 250 | "source": [ 251 | "\"I'm using Python!\" # double quotes" 252 | ], 253 | "execution_count": 17, 254 | "outputs": [ 255 | { 256 | "output_type": "execute_result", 257 | "data": { 258 | "text/plain": [ 259 | "\"I'm using Python!\"" 260 | ] 261 | }, 262 | "metadata": { 263 | "tags": [] 264 | }, 265 | "execution_count": 17 266 | } 267 | ] 268 | }, 269 | { 270 | "metadata": { 271 | "id": "FUXAHChy3e25", 272 | "colab_type": "text" 273 | }, 274 | "cell_type": "markdown", 275 | "source": [ 276 | "### Printing" 277 | ] 278 | }, 279 | { 280 | "metadata": { 281 | "id": "p9TddEmf3VMd", 282 | "colab_type": "code", 283 | "colab": {} 284 | }, 285 | "cell_type": "code", 286 | "source": [ 287 | "x = 'hello'" 288 | ], 289 | "execution_count": 0, 290 | "outputs": [] 291 | }, 292 | { 293 | "metadata": { 294 | "id": "J9gM9ClC3doX", 295 | "colab_type": "code", 296 | "colab": { 297 | "base_uri": "https://localhost:8080/", 298 | "height": 34 299 | }, 300 | "outputId": "cb6097ec-5f79-49db-c6b7-e97f6cb4c6b9" 301 | }, 302 | "cell_type": "code", 303 | "source": [ 304 | "x" 305 | ], 306 | "execution_count": 19, 307 | "outputs": [ 308 | { 309 | "output_type": "execute_result", 310 | "data": { 311 | "text/plain": [ 312 | "'hello'" 313 | ] 314 | }, 315 | "metadata": { 316 | "tags": [] 317 | }, 318 | "execution_count": 19 319 | } 320 | ] 321 | }, 322 | { 323 | "metadata": { 324 | "id": "vzxQe8mM3l89", 325 | "colab_type": "code", 326 | "colab": { 327 | "base_uri": "https://localhost:8080/", 328 | "height": 34 329 | }, 330 | "outputId": "33989622-b80c-4783-a7ee-c82713ea7a81" 331 | }, 332 | "cell_type": "code", 333 | "source": [ 334 | "print(x)" 335 | ], 336 | "execution_count": 20, 337 | "outputs": [ 338 | { 339 | "output_type": "stream", 340 | "text": [ 341 | "hello\n" 342 | ], 343 | "name": "stdout" 344 | } 345 | ] 346 | }, 347 | { 348 | "metadata": { 349 | "id": "sVoxA6Z_3nzj", 350 | "colab_type": "code", 351 | "colab": {} 352 | }, 353 | "cell_type": "code", 354 | "source": [ 355 | "code = 99\n", 356 | "name = 'Yash'" 357 | ], 358 | "execution_count": 0, 359 | "outputs": [] 360 | }, 361 | { 362 | "metadata": { 363 | "id": "B3K_tHcI3r0u", 364 | "colab_type": "code", 365 | "colab": { 366 | "base_uri": "https://localhost:8080/", 367 | "height": 34 368 | }, 369 | "outputId": "5b28b425-5ce4-4e2e-8a28-a6b15a2d711d" 370 | }, 371 | "cell_type": "code", 372 | "source": [ 373 | "print('My name is {} and my code is {}'.format(name, code))" 374 | ], 375 | "execution_count": 22, 376 | "outputs": [ 377 | { 378 | "output_type": "stream", 379 | "text": [ 380 | "My name is Yash and my code is 99\n" 381 | ], 382 | "name": "stdout" 383 | } 384 | ] 385 | }, 386 | { 387 | "metadata": { 388 | "id": "j0OaNMvu4Ovj", 389 | "colab_type": "code", 390 | "colab": { 391 | "base_uri": "https://localhost:8080/", 392 | "height": 34 393 | }, 394 | "outputId": "b696a494-60ca-47ca-f087-16fece59757f" 395 | }, 396 | "cell_type": "code", 397 | "source": [ 398 | "print('My name is {one} and my code is {two}'.format(one=name, two=code))" 399 | ], 400 | "execution_count": 23, 401 | "outputs": [ 402 | { 403 | "output_type": "stream", 404 | "text": [ 405 | "My name is Yash and my code is 99\n" 406 | ], 407 | "name": "stdout" 408 | } 409 | ] 410 | }, 411 | { 412 | "metadata": { 413 | "id": "5IlXRHAj4s-E", 414 | "colab_type": "text" 415 | }, 416 | "cell_type": "markdown", 417 | "source": [ 418 | "### Lists" 419 | ] 420 | }, 421 | { 422 | "metadata": { 423 | "id": "akbZGNb_4bUB", 424 | "colab_type": "code", 425 | "colab": { 426 | "base_uri": "https://localhost:8080/", 427 | "height": 34 428 | }, 429 | "outputId": "94d9a3fd-d0c1-496c-e6c3-578194c10f1d" 430 | }, 431 | "cell_type": "code", 432 | "source": [ 433 | "[1,2,3]" 434 | ], 435 | "execution_count": 24, 436 | "outputs": [ 437 | { 438 | "output_type": "execute_result", 439 | "data": { 440 | "text/plain": [ 441 | "[1, 2, 3]" 442 | ] 443 | }, 444 | "metadata": { 445 | "tags": [] 446 | }, 447 | "execution_count": 24 448 | } 449 | ] 450 | }, 451 | { 452 | "metadata": { 453 | "id": "rxSSVfGu4wgK", 454 | "colab_type": "code", 455 | "colab": { 456 | "base_uri": "https://localhost:8080/", 457 | "height": 34 458 | }, 459 | "outputId": "0301ae04-5e96-4c66-d613-419e8678d75c" 460 | }, 461 | "cell_type": "code", 462 | "source": [ 463 | "['hi',1,[1,2]]\n" 464 | ], 465 | "execution_count": 25, 466 | "outputs": [ 467 | { 468 | "output_type": "execute_result", 469 | "data": { 470 | "text/plain": [ 471 | "['hi', 1, [1, 2]]" 472 | ] 473 | }, 474 | "metadata": { 475 | "tags": [] 476 | }, 477 | "execution_count": 25 478 | } 479 | ] 480 | }, 481 | { 482 | "metadata": { 483 | "id": "97vjsGBn4ypm", 484 | "colab_type": "code", 485 | "colab": {} 486 | }, 487 | "cell_type": "code", 488 | "source": [ 489 | "my_list = ['a','b','c']" 490 | ], 491 | "execution_count": 0, 492 | "outputs": [] 493 | }, 494 | { 495 | "metadata": { 496 | "id": "bTwCeH_141zh", 497 | "colab_type": "code", 498 | "colab": {} 499 | }, 500 | "cell_type": "code", 501 | "source": [ 502 | "my_list.append('d')" 503 | ], 504 | "execution_count": 0, 505 | "outputs": [] 506 | }, 507 | { 508 | "metadata": { 509 | "id": "xS96Xaw4438H", 510 | "colab_type": "code", 511 | "colab": { 512 | "base_uri": "https://localhost:8080/", 513 | "height": 34 514 | }, 515 | "outputId": "78c3f2a1-fc11-4584-8872-c179efd442dc" 516 | }, 517 | "cell_type": "code", 518 | "source": [ 519 | "my_list" 520 | ], 521 | "execution_count": 28, 522 | "outputs": [ 523 | { 524 | "output_type": "execute_result", 525 | "data": { 526 | "text/plain": [ 527 | "['a', 'b', 'c', 'd']" 528 | ] 529 | }, 530 | "metadata": { 531 | "tags": [] 532 | }, 533 | "execution_count": 28 534 | } 535 | ] 536 | }, 537 | { 538 | "metadata": { 539 | "id": "yoz3IfoF45nD", 540 | "colab_type": "code", 541 | "colab": { 542 | "base_uri": "https://localhost:8080/", 543 | "height": 34 544 | }, 545 | "outputId": "237916b2-017d-4c91-e7f9-b07c94af7324" 546 | }, 547 | "cell_type": "code", 548 | "source": [ 549 | "my_list[0]" 550 | ], 551 | "execution_count": 29, 552 | "outputs": [ 553 | { 554 | "output_type": "execute_result", 555 | "data": { 556 | "text/plain": [ 557 | "'a'" 558 | ] 559 | }, 560 | "metadata": { 561 | "tags": [] 562 | }, 563 | "execution_count": 29 564 | } 565 | ] 566 | }, 567 | { 568 | "metadata": { 569 | "id": "9ZfMKDvn47Wl", 570 | "colab_type": "code", 571 | "colab": { 572 | "base_uri": "https://localhost:8080/", 573 | "height": 34 574 | }, 575 | "outputId": "9c7a2ed1-d177-4edc-a836-4e38d2b2e7c6" 576 | }, 577 | "cell_type": "code", 578 | "source": [ 579 | "my_list[1]" 580 | ], 581 | "execution_count": 30, 582 | "outputs": [ 583 | { 584 | "output_type": "execute_result", 585 | "data": { 586 | "text/plain": [ 587 | "'b'" 588 | ] 589 | }, 590 | "metadata": { 591 | "tags": [] 592 | }, 593 | "execution_count": 30 594 | } 595 | ] 596 | }, 597 | { 598 | "metadata": { 599 | "id": "jmYcwhbM48sZ", 600 | "colab_type": "code", 601 | "colab": { 602 | "base_uri": "https://localhost:8080/", 603 | "height": 34 604 | }, 605 | "outputId": "85781ecc-7621-4065-c4ff-8909ff99c9c2" 606 | }, 607 | "cell_type": "code", 608 | "source": [ 609 | "my_list[1:]" 610 | ], 611 | "execution_count": 31, 612 | "outputs": [ 613 | { 614 | "output_type": "execute_result", 615 | "data": { 616 | "text/plain": [ 617 | "['b', 'c', 'd']" 618 | ] 619 | }, 620 | "metadata": { 621 | "tags": [] 622 | }, 623 | "execution_count": 31 624 | } 625 | ] 626 | }, 627 | { 628 | "metadata": { 629 | "id": "nmP4d-c44_E3", 630 | "colab_type": "code", 631 | "colab": { 632 | "base_uri": "https://localhost:8080/", 633 | "height": 34 634 | }, 635 | "outputId": "4149bac9-a2b1-45f3-db27-d69c78a3e438" 636 | }, 637 | "cell_type": "code", 638 | "source": [ 639 | "my_list[:1]" 640 | ], 641 | "execution_count": 32, 642 | "outputs": [ 643 | { 644 | "output_type": "execute_result", 645 | "data": { 646 | "text/plain": [ 647 | "['a']" 648 | ] 649 | }, 650 | "metadata": { 651 | "tags": [] 652 | }, 653 | "execution_count": 32 654 | } 655 | ] 656 | }, 657 | { 658 | "metadata": { 659 | "id": "5KKn22ji5BYT", 660 | "colab_type": "code", 661 | "colab": {} 662 | }, 663 | "cell_type": "code", 664 | "source": [ 665 | "my_list[0] = 'Yash'" 666 | ], 667 | "execution_count": 0, 668 | "outputs": [] 669 | }, 670 | { 671 | "metadata": { 672 | "id": "8uc8Fybx5EzJ", 673 | "colab_type": "code", 674 | "colab": { 675 | "base_uri": "https://localhost:8080/", 676 | "height": 34 677 | }, 678 | "outputId": "f424d08b-f82e-42b3-8251-0bf1b887cfc3" 679 | }, 680 | "cell_type": "code", 681 | "source": [ 682 | "my_list" 683 | ], 684 | "execution_count": 34, 685 | "outputs": [ 686 | { 687 | "output_type": "execute_result", 688 | "data": { 689 | "text/plain": [ 690 | "['Yash', 'b', 'c', 'd']" 691 | ] 692 | }, 693 | "metadata": { 694 | "tags": [] 695 | }, 696 | "execution_count": 34 697 | } 698 | ] 699 | }, 700 | { 701 | "metadata": { 702 | "id": "ij_L9KXR5GPJ", 703 | "colab_type": "code", 704 | "colab": {} 705 | }, 706 | "cell_type": "code", 707 | "source": [ 708 | "nest = [1,2,3,[4,5,['target']]]" 709 | ], 710 | "execution_count": 0, 711 | "outputs": [] 712 | }, 713 | { 714 | "metadata": { 715 | "id": "sGi8sypK5Ihh", 716 | "colab_type": "code", 717 | "colab": { 718 | "base_uri": "https://localhost:8080/", 719 | "height": 34 720 | }, 721 | "outputId": "8d67d2b0-e547-40f2-bbc7-c83d3a8ae144" 722 | }, 723 | "cell_type": "code", 724 | "source": [ 725 | "nest[3]" 726 | ], 727 | "execution_count": 36, 728 | "outputs": [ 729 | { 730 | "output_type": "execute_result", 731 | "data": { 732 | "text/plain": [ 733 | "[4, 5, ['target']]" 734 | ] 735 | }, 736 | "metadata": { 737 | "tags": [] 738 | }, 739 | "execution_count": 36 740 | } 741 | ] 742 | }, 743 | { 744 | "metadata": { 745 | "id": "GC_pAWKH5KNa", 746 | "colab_type": "code", 747 | "colab": { 748 | "base_uri": "https://localhost:8080/", 749 | "height": 34 750 | }, 751 | "outputId": "fbd9e014-58db-4ce8-e3d3-79364ae94a86" 752 | }, 753 | "cell_type": "code", 754 | "source": [ 755 | "nest[3][2]" 756 | ], 757 | "execution_count": 37, 758 | "outputs": [ 759 | { 760 | "output_type": "execute_result", 761 | "data": { 762 | "text/plain": [ 763 | "['target']" 764 | ] 765 | }, 766 | "metadata": { 767 | "tags": [] 768 | }, 769 | "execution_count": 37 770 | } 771 | ] 772 | }, 773 | { 774 | "metadata": { 775 | "id": "4AJCWsVT5NSC", 776 | "colab_type": "code", 777 | "colab": { 778 | "base_uri": "https://localhost:8080/", 779 | "height": 34 780 | }, 781 | "outputId": "54c06512-b59a-4fcd-95f8-6829f7bf42eb" 782 | }, 783 | "cell_type": "code", 784 | "source": [ 785 | "nest[3][2][0]" 786 | ], 787 | "execution_count": 38, 788 | "outputs": [ 789 | { 790 | "output_type": "execute_result", 791 | "data": { 792 | "text/plain": [ 793 | "'target'" 794 | ] 795 | }, 796 | "metadata": { 797 | "tags": [] 798 | }, 799 | "execution_count": 38 800 | } 801 | ] 802 | }, 803 | { 804 | "metadata": { 805 | "id": "SB6PyGdZ5Syc", 806 | "colab_type": "text" 807 | }, 808 | "cell_type": "markdown", 809 | "source": [ 810 | "### Dictionaries" 811 | ] 812 | }, 813 | { 814 | "metadata": { 815 | "id": "WinNT0Ix5OvS", 816 | "colab_type": "code", 817 | "colab": {} 818 | }, 819 | "cell_type": "code", 820 | "source": [ 821 | "d = {'key1':'item1','key2':'item2'}" 822 | ], 823 | "execution_count": 0, 824 | "outputs": [] 825 | }, 826 | { 827 | "metadata": { 828 | "id": "hOznjvPM5WGv", 829 | "colab_type": "code", 830 | "colab": { 831 | "base_uri": "https://localhost:8080/", 832 | "height": 34 833 | }, 834 | "outputId": "ac81810b-234e-444a-a665-1dd3fc5d49c1" 835 | }, 836 | "cell_type": "code", 837 | "source": [ 838 | "d" 839 | ], 840 | "execution_count": 40, 841 | "outputs": [ 842 | { 843 | "output_type": "execute_result", 844 | "data": { 845 | "text/plain": [ 846 | "{'key1': 'item1', 'key2': 'item2'}" 847 | ] 848 | }, 849 | "metadata": { 850 | "tags": [] 851 | }, 852 | "execution_count": 40 853 | } 854 | ] 855 | }, 856 | { 857 | "metadata": { 858 | "id": "BuTtVkzB5Xtk", 859 | "colab_type": "code", 860 | "colab": { 861 | "base_uri": "https://localhost:8080/", 862 | "height": 34 863 | }, 864 | "outputId": "17628ea5-02e3-46d2-9b38-47b9c78832e7" 865 | }, 866 | "cell_type": "code", 867 | "source": [ 868 | "d['key1']" 869 | ], 870 | "execution_count": 41, 871 | "outputs": [ 872 | { 873 | "output_type": "execute_result", 874 | "data": { 875 | "text/plain": [ 876 | "'item1'" 877 | ] 878 | }, 879 | "metadata": { 880 | "tags": [] 881 | }, 882 | "execution_count": 41 883 | } 884 | ] 885 | }, 886 | { 887 | "metadata": { 888 | "id": "8_BHmGo45eUC", 889 | "colab_type": "text" 890 | }, 891 | "cell_type": "markdown", 892 | "source": [ 893 | "### Booleans" 894 | ] 895 | }, 896 | { 897 | "metadata": { 898 | "id": "6fa6u9t95ZkY", 899 | "colab_type": "code", 900 | "colab": {} 901 | }, 902 | "cell_type": "code", 903 | "source": [ 904 | "a = True" 905 | ], 906 | "execution_count": 0, 907 | "outputs": [] 908 | }, 909 | { 910 | "metadata": { 911 | "id": "vks1-8nt5cSo", 912 | "colab_type": "code", 913 | "colab": { 914 | "base_uri": "https://localhost:8080/", 915 | "height": 34 916 | }, 917 | "outputId": "7c815e52-0c88-465a-9933-18e73bef6dd0" 918 | }, 919 | "cell_type": "code", 920 | "source": [ 921 | "a == False" 922 | ], 923 | "execution_count": 43, 924 | "outputs": [ 925 | { 926 | "output_type": "execute_result", 927 | "data": { 928 | "text/plain": [ 929 | "False" 930 | ] 931 | }, 932 | "metadata": { 933 | "tags": [] 934 | }, 935 | "execution_count": 43 936 | } 937 | ] 938 | }, 939 | { 940 | "metadata": { 941 | "id": "4_VfftWq5zMc", 942 | "colab_type": "code", 943 | "colab": { 944 | "base_uri": "https://localhost:8080/", 945 | "height": 34 946 | }, 947 | "outputId": "1061814d-4ccc-4de7-a720-23b037b83ce4" 948 | }, 949 | "cell_type": "code", 950 | "source": [ 951 | "a == True" 952 | ], 953 | "execution_count": 44, 954 | "outputs": [ 955 | { 956 | "output_type": "execute_result", 957 | "data": { 958 | "text/plain": [ 959 | "True" 960 | ] 961 | }, 962 | "metadata": { 963 | "tags": [] 964 | }, 965 | "execution_count": 44 966 | } 967 | ] 968 | }, 969 | { 970 | "metadata": { 971 | "id": "Tn0Dpk2e6H23", 972 | "colab_type": "text" 973 | }, 974 | "cell_type": "markdown", 975 | "source": [ 976 | "### Tuples" 977 | ] 978 | }, 979 | { 980 | "metadata": { 981 | "id": "whA96ytJ6AyS", 982 | "colab_type": "code", 983 | "colab": {} 984 | }, 985 | "cell_type": "code", 986 | "source": [ 987 | "t = (1,2,3)" 988 | ], 989 | "execution_count": 0, 990 | "outputs": [] 991 | }, 992 | { 993 | "metadata": { 994 | "id": "HFpa1Mtd6LBo", 995 | "colab_type": "code", 996 | "colab": { 997 | "base_uri": "https://localhost:8080/", 998 | "height": 34 999 | }, 1000 | "outputId": "52f6225f-b865-4678-8f9e-3c9a2aedbbc5" 1001 | }, 1002 | "cell_type": "code", 1003 | "source": [ 1004 | "t[0]" 1005 | ], 1006 | "execution_count": 46, 1007 | "outputs": [ 1008 | { 1009 | "output_type": "execute_result", 1010 | "data": { 1011 | "text/plain": [ 1012 | "1" 1013 | ] 1014 | }, 1015 | "metadata": { 1016 | "tags": [] 1017 | }, 1018 | "execution_count": 46 1019 | } 1020 | ] 1021 | }, 1022 | { 1023 | "metadata": { 1024 | "id": "DgyyEZag6MNe", 1025 | "colab_type": "code", 1026 | "colab": { 1027 | "base_uri": "https://localhost:8080/", 1028 | "height": 167 1029 | }, 1030 | "outputId": "52564c7b-976d-4c4a-87d7-afc1dba0e85c" 1031 | }, 1032 | "cell_type": "code", 1033 | "source": [ 1034 | "t[0] = 'NEW' # tuple is immutable" 1035 | ], 1036 | "execution_count": 47, 1037 | "outputs": [ 1038 | { 1039 | "output_type": "error", 1040 | "ename": "TypeError", 1041 | "evalue": "ignored", 1042 | "traceback": [ 1043 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 1044 | "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", 1045 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mt\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'NEW'\u001b[0m \u001b[0;31m# tuple is immutable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 1046 | "\u001b[0;31mTypeError\u001b[0m: 'tuple' object does not support item assignment" 1047 | ] 1048 | } 1049 | ] 1050 | }, 1051 | { 1052 | "metadata": { 1053 | "id": "ezaZ5cZl6Y34", 1054 | "colab_type": "text" 1055 | }, 1056 | "cell_type": "markdown", 1057 | "source": [ 1058 | "### Sets" 1059 | ] 1060 | }, 1061 | { 1062 | "metadata": { 1063 | "id": "g8lqL3IF6OTn", 1064 | "colab_type": "code", 1065 | "colab": { 1066 | "base_uri": "https://localhost:8080/", 1067 | "height": 35 1068 | }, 1069 | "outputId": "e6d2189b-e08e-428e-9e19-8f3a63f98b98" 1070 | }, 1071 | "cell_type": "code", 1072 | "source": [ 1073 | "{1,2,3}" 1074 | ], 1075 | "execution_count": 59, 1076 | "outputs": [ 1077 | { 1078 | "output_type": "execute_result", 1079 | "data": { 1080 | "text/plain": [ 1081 | "{1, 2, 3}" 1082 | ] 1083 | }, 1084 | "metadata": { 1085 | "tags": [] 1086 | }, 1087 | "execution_count": 59 1088 | } 1089 | ] 1090 | }, 1091 | { 1092 | "metadata": { 1093 | "id": "NRQqY00Z6a1S", 1094 | "colab_type": "code", 1095 | "colab": { 1096 | "base_uri": "https://localhost:8080/", 1097 | "height": 35 1098 | }, 1099 | "outputId": "3d759c16-fdeb-47bd-d555-328e369fb0f0" 1100 | }, 1101 | "cell_type": "code", 1102 | "source": [ 1103 | "{1,2,3,1,2,1,2,3,3,3,3,2,2,2,1,1,2}" 1104 | ], 1105 | "execution_count": 60, 1106 | "outputs": [ 1107 | { 1108 | "output_type": "execute_result", 1109 | "data": { 1110 | "text/plain": [ 1111 | "{1, 2, 3}" 1112 | ] 1113 | }, 1114 | "metadata": { 1115 | "tags": [] 1116 | }, 1117 | "execution_count": 60 1118 | } 1119 | ] 1120 | }, 1121 | { 1122 | "metadata": { 1123 | "id": "OoSnNOv26dly", 1124 | "colab_type": "text" 1125 | }, 1126 | "cell_type": "markdown", 1127 | "source": [ 1128 | "### Comparison Operators" 1129 | ] 1130 | }, 1131 | { 1132 | "metadata": { 1133 | "id": "7LTQ6p1h6b3j", 1134 | "colab_type": "code", 1135 | "colab": { 1136 | "base_uri": "https://localhost:8080/", 1137 | "height": 35 1138 | }, 1139 | "outputId": "be0d13bf-58f3-4ecd-d21e-7fdf3e613d89" 1140 | }, 1141 | "cell_type": "code", 1142 | "source": [ 1143 | "1 > 2" 1144 | ], 1145 | "execution_count": 61, 1146 | "outputs": [ 1147 | { 1148 | "output_type": "execute_result", 1149 | "data": { 1150 | "text/plain": [ 1151 | "False" 1152 | ] 1153 | }, 1154 | "metadata": { 1155 | "tags": [] 1156 | }, 1157 | "execution_count": 61 1158 | } 1159 | ] 1160 | }, 1161 | { 1162 | "metadata": { 1163 | "id": "HwuKFV9p6h8m", 1164 | "colab_type": "code", 1165 | "colab": { 1166 | "base_uri": "https://localhost:8080/", 1167 | "height": 35 1168 | }, 1169 | "outputId": "1fd8b3e7-d458-45c6-f089-1804768b9dcc" 1170 | }, 1171 | "cell_type": "code", 1172 | "source": [ 1173 | "1 < 2" 1174 | ], 1175 | "execution_count": 62, 1176 | "outputs": [ 1177 | { 1178 | "output_type": "execute_result", 1179 | "data": { 1180 | "text/plain": [ 1181 | "True" 1182 | ] 1183 | }, 1184 | "metadata": { 1185 | "tags": [] 1186 | }, 1187 | "execution_count": 62 1188 | } 1189 | ] 1190 | }, 1191 | { 1192 | "metadata": { 1193 | "id": "Nlbab_Dh6jBp", 1194 | "colab_type": "code", 1195 | "colab": { 1196 | "base_uri": "https://localhost:8080/", 1197 | "height": 35 1198 | }, 1199 | "outputId": "c16080be-3367-4852-a8ab-314eb046e73e" 1200 | }, 1201 | "cell_type": "code", 1202 | "source": [ 1203 | "'hi' == 'bye'" 1204 | ], 1205 | "execution_count": 63, 1206 | "outputs": [ 1207 | { 1208 | "output_type": "execute_result", 1209 | "data": { 1210 | "text/plain": [ 1211 | "False" 1212 | ] 1213 | }, 1214 | "metadata": { 1215 | "tags": [] 1216 | }, 1217 | "execution_count": 63 1218 | } 1219 | ] 1220 | }, 1221 | { 1222 | "metadata": { 1223 | "id": "uQKQhJkf6mIA", 1224 | "colab_type": "code", 1225 | "colab": { 1226 | "base_uri": "https://localhost:8080/", 1227 | "height": 35 1228 | }, 1229 | "outputId": "f2030171-75cc-400a-c859-7abb7d4ffdaa" 1230 | }, 1231 | "cell_type": "code", 1232 | "source": [ 1233 | "'hi' == 'hi'" 1234 | ], 1235 | "execution_count": 64, 1236 | "outputs": [ 1237 | { 1238 | "output_type": "execute_result", 1239 | "data": { 1240 | "text/plain": [ 1241 | "True" 1242 | ] 1243 | }, 1244 | "metadata": { 1245 | "tags": [] 1246 | }, 1247 | "execution_count": 64 1248 | } 1249 | ] 1250 | }, 1251 | { 1252 | "metadata": { 1253 | "id": "MTsTvmyc6sGE", 1254 | "colab_type": "text" 1255 | }, 1256 | "cell_type": "markdown", 1257 | "source": [ 1258 | "### Logic Operators" 1259 | ] 1260 | }, 1261 | { 1262 | "metadata": { 1263 | "id": "2lGfHXAE6o2S", 1264 | "colab_type": "code", 1265 | "colab": { 1266 | "base_uri": "https://localhost:8080/", 1267 | "height": 35 1268 | }, 1269 | "outputId": "a098f069-0a7b-43f8-96d7-ee17156f9628" 1270 | }, 1271 | "cell_type": "code", 1272 | "source": [ 1273 | "(1 > 2) and (2 < 3)" 1274 | ], 1275 | "execution_count": 65, 1276 | "outputs": [ 1277 | { 1278 | "output_type": "execute_result", 1279 | "data": { 1280 | "text/plain": [ 1281 | "False" 1282 | ] 1283 | }, 1284 | "metadata": { 1285 | "tags": [] 1286 | }, 1287 | "execution_count": 65 1288 | } 1289 | ] 1290 | }, 1291 | { 1292 | "metadata": { 1293 | "id": "09CkE1qh6vWM", 1294 | "colab_type": "code", 1295 | "colab": { 1296 | "base_uri": "https://localhost:8080/", 1297 | "height": 35 1298 | }, 1299 | "outputId": "0f883574-76f5-41c4-ac73-0f18f4a4576b" 1300 | }, 1301 | "cell_type": "code", 1302 | "source": [ 1303 | "(1 > 2) or (2 < 3)" 1304 | ], 1305 | "execution_count": 66, 1306 | "outputs": [ 1307 | { 1308 | "output_type": "execute_result", 1309 | "data": { 1310 | "text/plain": [ 1311 | "True" 1312 | ] 1313 | }, 1314 | "metadata": { 1315 | "tags": [] 1316 | }, 1317 | "execution_count": 66 1318 | } 1319 | ] 1320 | }, 1321 | { 1322 | "metadata": { 1323 | "id": "w4oiqTap6xCN", 1324 | "colab_type": "code", 1325 | "colab": { 1326 | "base_uri": "https://localhost:8080/", 1327 | "height": 35 1328 | }, 1329 | "outputId": "945986c2-df31-45dd-a122-dee8e91c7c6c" 1330 | }, 1331 | "cell_type": "code", 1332 | "source": [ 1333 | "(1 == 2) or (2 == 3) or (4 == 4)" 1334 | ], 1335 | "execution_count": 67, 1336 | "outputs": [ 1337 | { 1338 | "output_type": "execute_result", 1339 | "data": { 1340 | "text/plain": [ 1341 | "True" 1342 | ] 1343 | }, 1344 | "metadata": { 1345 | "tags": [] 1346 | }, 1347 | "execution_count": 67 1348 | } 1349 | ] 1350 | }, 1351 | { 1352 | "metadata": { 1353 | "id": "JQFE5swa61wa", 1354 | "colab_type": "text" 1355 | }, 1356 | "cell_type": "markdown", 1357 | "source": [ 1358 | "## Conditions" 1359 | ] 1360 | }, 1361 | { 1362 | "metadata": { 1363 | "id": "rPqx0A-C7LJk", 1364 | "colab_type": "text" 1365 | }, 1366 | "cell_type": "markdown", 1367 | "source": [ 1368 | "### if statement" 1369 | ] 1370 | }, 1371 | { 1372 | "metadata": { 1373 | "id": "ZE-dL8qM6zsH", 1374 | "colab_type": "code", 1375 | "colab": { 1376 | "base_uri": "https://localhost:8080/", 1377 | "height": 35 1378 | }, 1379 | "outputId": "2d108b46-0780-4d75-8e8f-ae3ef40755a7" 1380 | }, 1381 | "cell_type": "code", 1382 | "source": [ 1383 | "if 1 < 2:\n", 1384 | " print('Yep!')" 1385 | ], 1386 | "execution_count": 69, 1387 | "outputs": [ 1388 | { 1389 | "output_type": "stream", 1390 | "text": [ 1391 | "Yep!\n" 1392 | ], 1393 | "name": "stdout" 1394 | } 1395 | ] 1396 | }, 1397 | { 1398 | "metadata": { 1399 | "id": "RzHN-ByZ7Q-m", 1400 | "colab_type": "code", 1401 | "colab": {} 1402 | }, 1403 | "cell_type": "code", 1404 | "source": [ 1405 | "if 1 > 2:\n", 1406 | " print('yep!')" 1407 | ], 1408 | "execution_count": 0, 1409 | "outputs": [] 1410 | }, 1411 | { 1412 | "metadata": { 1413 | "id": "Hf0ozL3J9YRQ", 1414 | "colab_type": "code", 1415 | "colab": { 1416 | "base_uri": "https://localhost:8080/", 1417 | "height": 34 1418 | }, 1419 | "outputId": "026f060d-9335-4b71-d442-761e48b6c1bc" 1420 | }, 1421 | "cell_type": "code", 1422 | "source": [ 1423 | "attr = ['larry', 'curly', 'moe']\n", 1424 | "if 'curly' in attr:\n", 1425 | " print ('Yay')" 1426 | ], 1427 | "execution_count": 8, 1428 | "outputs": [ 1429 | { 1430 | "output_type": "stream", 1431 | "text": [ 1432 | "Yay\n" 1433 | ], 1434 | "name": "stdout" 1435 | } 1436 | ] 1437 | }, 1438 | { 1439 | "metadata": { 1440 | "id": "c6AxCHy27YPA", 1441 | "colab_type": "text" 1442 | }, 1443 | "cell_type": "markdown", 1444 | "source": [ 1445 | "### if...else statement" 1446 | ] 1447 | }, 1448 | { 1449 | "metadata": { 1450 | "id": "RUZpllLv7WmZ", 1451 | "colab_type": "code", 1452 | "colab": { 1453 | "base_uri": "https://localhost:8080/", 1454 | "height": 35 1455 | }, 1456 | "outputId": "0051b312-72d6-441d-9270-8d0ebf4e22e1" 1457 | }, 1458 | "cell_type": "code", 1459 | "source": [ 1460 | "if 1 < 2:\n", 1461 | " print('first')\n", 1462 | "else:\n", 1463 | " print('last')" 1464 | ], 1465 | "execution_count": 71, 1466 | "outputs": [ 1467 | { 1468 | "output_type": "stream", 1469 | "text": [ 1470 | "first\n" 1471 | ], 1472 | "name": "stdout" 1473 | } 1474 | ] 1475 | }, 1476 | { 1477 | "metadata": { 1478 | "id": "dlgfA--V7etY", 1479 | "colab_type": "code", 1480 | "colab": { 1481 | "base_uri": "https://localhost:8080/", 1482 | "height": 35 1483 | }, 1484 | "outputId": "c71fffba-9780-43f9-b7bc-0bd6f66db897" 1485 | }, 1486 | "cell_type": "code", 1487 | "source": [ 1488 | "if 1 > 2:\n", 1489 | " print('first')\n", 1490 | "else:\n", 1491 | " print('last')" 1492 | ], 1493 | "execution_count": 72, 1494 | "outputs": [ 1495 | { 1496 | "output_type": "stream", 1497 | "text": [ 1498 | "last\n" 1499 | ], 1500 | "name": "stdout" 1501 | } 1502 | ] 1503 | }, 1504 | { 1505 | "metadata": { 1506 | "id": "NnzpPWfM7lRF", 1507 | "colab_type": "text" 1508 | }, 1509 | "cell_type": "markdown", 1510 | "source": [ 1511 | "### if...else...elif statement" 1512 | ] 1513 | }, 1514 | { 1515 | "metadata": { 1516 | "id": "CkEyXxnO7ivK", 1517 | "colab_type": "code", 1518 | "colab": { 1519 | "base_uri": "https://localhost:8080/", 1520 | "height": 35 1521 | }, 1522 | "outputId": "bebfe545-45a8-4253-e735-0db8e03391cf" 1523 | }, 1524 | "cell_type": "code", 1525 | "source": [ 1526 | "if 1 == 2:\n", 1527 | " print('first')\n", 1528 | " \n", 1529 | "elif 3 == 3:\n", 1530 | " print('middle')\n", 1531 | " \n", 1532 | "else:\n", 1533 | " print('Last')" 1534 | ], 1535 | "execution_count": 74, 1536 | "outputs": [ 1537 | { 1538 | "output_type": "stream", 1539 | "text": [ 1540 | "middle\n" 1541 | ], 1542 | "name": "stdout" 1543 | } 1544 | ] 1545 | }, 1546 | { 1547 | "metadata": { 1548 | "id": "HoCoPly67v9e", 1549 | "colab_type": "text" 1550 | }, 1551 | "cell_type": "markdown", 1552 | "source": [ 1553 | "## Loops" 1554 | ] 1555 | }, 1556 | { 1557 | "metadata": { 1558 | "id": "JfOHwO7q70iR", 1559 | "colab_type": "text" 1560 | }, 1561 | "cell_type": "markdown", 1562 | "source": [ 1563 | "### For loop" 1564 | ] 1565 | }, 1566 | { 1567 | "metadata": { 1568 | "id": "3YCD50be7y45", 1569 | "colab_type": "code", 1570 | "colab": {} 1571 | }, 1572 | "cell_type": "code", 1573 | "source": [ 1574 | "seq = [1,2,3,4,5]" 1575 | ], 1576 | "execution_count": 0, 1577 | "outputs": [] 1578 | }, 1579 | { 1580 | "metadata": { 1581 | "id": "JlS8IsHh73qw", 1582 | "colab_type": "code", 1583 | "colab": { 1584 | "base_uri": "https://localhost:8080/", 1585 | "height": 107 1586 | }, 1587 | "outputId": "70a2353f-f800-476e-d322-9c1f72452de4" 1588 | }, 1589 | "cell_type": "code", 1590 | "source": [ 1591 | "for item in seq:\n", 1592 | " print(item)" 1593 | ], 1594 | "execution_count": 76, 1595 | "outputs": [ 1596 | { 1597 | "output_type": "stream", 1598 | "text": [ 1599 | "1\n", 1600 | "2\n", 1601 | "3\n", 1602 | "4\n", 1603 | "5\n" 1604 | ], 1605 | "name": "stdout" 1606 | } 1607 | ] 1608 | }, 1609 | { 1610 | "metadata": { 1611 | "id": "hdDYvzFC75Ug", 1612 | "colab_type": "code", 1613 | "colab": { 1614 | "base_uri": "https://localhost:8080/", 1615 | "height": 107 1616 | }, 1617 | "outputId": "1b641701-b4cf-4649-9aac-85b887e18169" 1618 | }, 1619 | "cell_type": "code", 1620 | "source": [ 1621 | "for item in seq:\n", 1622 | " print('Yep')" 1623 | ], 1624 | "execution_count": 77, 1625 | "outputs": [ 1626 | { 1627 | "output_type": "stream", 1628 | "text": [ 1629 | "Yep\n", 1630 | "Yep\n", 1631 | "Yep\n", 1632 | "Yep\n", 1633 | "Yep\n" 1634 | ], 1635 | "name": "stdout" 1636 | } 1637 | ] 1638 | }, 1639 | { 1640 | "metadata": { 1641 | "id": "jio0SxZa77Py", 1642 | "colab_type": "code", 1643 | "colab": { 1644 | "base_uri": "https://localhost:8080/", 1645 | "height": 107 1646 | }, 1647 | "outputId": "a22952c3-7bf9-47ae-edd6-70adcc7a3acb" 1648 | }, 1649 | "cell_type": "code", 1650 | "source": [ 1651 | "countries = \"USA,India,China,Canada,UK\"\n", 1652 | "\n", 1653 | "for country in countries.split(','):\n", 1654 | " print(country)" 1655 | ], 1656 | "execution_count": 86, 1657 | "outputs": [ 1658 | { 1659 | "output_type": "stream", 1660 | "text": [ 1661 | "USA\n", 1662 | "India\n", 1663 | "China\n", 1664 | "Canada\n", 1665 | "UK\n" 1666 | ], 1667 | "name": "stdout" 1668 | } 1669 | ] 1670 | }, 1671 | { 1672 | "metadata": { 1673 | "id": "kmW6C-E49IN_", 1674 | "colab_type": "text" 1675 | }, 1676 | "cell_type": "markdown", 1677 | "source": [ 1678 | "### While loop" 1679 | ] 1680 | }, 1681 | { 1682 | "metadata": { 1683 | "id": "QV25CZ6Z79dE", 1684 | "colab_type": "code", 1685 | "colab": { 1686 | "base_uri": "https://localhost:8080/", 1687 | "height": 89 1688 | }, 1689 | "outputId": "bbd1051e-3fbe-457f-c140-44bc1a823713" 1690 | }, 1691 | "cell_type": "code", 1692 | "source": [ 1693 | "i = 1\n", 1694 | "while i < 5:\n", 1695 | " print('i is: {}'.format(i))\n", 1696 | " i = i+1" 1697 | ], 1698 | "execution_count": 90, 1699 | "outputs": [ 1700 | { 1701 | "output_type": "stream", 1702 | "text": [ 1703 | "i is: 1\n", 1704 | "i is: 2\n", 1705 | "i is: 3\n", 1706 | "i is: 4\n" 1707 | ], 1708 | "name": "stdout" 1709 | } 1710 | ] 1711 | }, 1712 | { 1713 | "metadata": { 1714 | "id": "Ttoh0TJI_DuL", 1715 | "colab_type": "text" 1716 | }, 1717 | "cell_type": "markdown", 1718 | "source": [ 1719 | "## More Python" 1720 | ] 1721 | }, 1722 | { 1723 | "metadata": { 1724 | "id": "yNwkW9tTADT2", 1725 | "colab_type": "text" 1726 | }, 1727 | "cell_type": "markdown", 1728 | "source": [ 1729 | "### range() function" 1730 | ] 1731 | }, 1732 | { 1733 | "metadata": { 1734 | "id": "dFfmcHMQ9L5R", 1735 | "colab_type": "code", 1736 | "colab": { 1737 | "base_uri": "https://localhost:8080/", 1738 | "height": 34 1739 | }, 1740 | "outputId": "c040fdd6-a112-4cbf-c18e-3a76b4c65431" 1741 | }, 1742 | "cell_type": "code", 1743 | "source": [ 1744 | "range(5)" 1745 | ], 1746 | "execution_count": 96, 1747 | "outputs": [ 1748 | { 1749 | "output_type": "execute_result", 1750 | "data": { 1751 | "text/plain": [ 1752 | "range(0, 5)" 1753 | ] 1754 | }, 1755 | "metadata": { 1756 | "tags": [] 1757 | }, 1758 | "execution_count": 96 1759 | } 1760 | ] 1761 | }, 1762 | { 1763 | "metadata": { 1764 | "id": "oStMPWpNALWD", 1765 | "colab_type": "code", 1766 | "colab": { 1767 | "base_uri": "https://localhost:8080/", 1768 | "height": 104 1769 | }, 1770 | "outputId": "2238c632-8209-460e-f18f-9908f4098242" 1771 | }, 1772 | "cell_type": "code", 1773 | "source": [ 1774 | "for i in range(5):\n", 1775 | " print(i)" 1776 | ], 1777 | "execution_count": 97, 1778 | "outputs": [ 1779 | { 1780 | "output_type": "stream", 1781 | "text": [ 1782 | "0\n", 1783 | "1\n", 1784 | "2\n", 1785 | "3\n", 1786 | "4\n" 1787 | ], 1788 | "name": "stdout" 1789 | } 1790 | ] 1791 | }, 1792 | { 1793 | "metadata": { 1794 | "id": "-CJIxSCcANip", 1795 | "colab_type": "code", 1796 | "colab": { 1797 | "base_uri": "https://localhost:8080/", 1798 | "height": 191 1799 | }, 1800 | "outputId": "2f74478f-6c0f-4be1-93b2-c5836a26e63b" 1801 | }, 1802 | "cell_type": "code", 1803 | "source": [ 1804 | "for i in range(0, 10):\n", 1805 | " print(i)" 1806 | ], 1807 | "execution_count": 103, 1808 | "outputs": [ 1809 | { 1810 | "output_type": "stream", 1811 | "text": [ 1812 | "0\n", 1813 | "1\n", 1814 | "2\n", 1815 | "3\n", 1816 | "4\n", 1817 | "5\n", 1818 | "6\n", 1819 | "7\n", 1820 | "8\n", 1821 | "9\n" 1822 | ], 1823 | "name": "stdout" 1824 | } 1825 | ] 1826 | }, 1827 | { 1828 | "metadata": { 1829 | "id": "LPYoIakFAPPB", 1830 | "colab_type": "code", 1831 | "colab": { 1832 | "base_uri": "https://localhost:8080/", 1833 | "height": 104 1834 | }, 1835 | "outputId": "ecbe4d15-5552-4ce4-ef8b-3c9cdab3eb8d" 1836 | }, 1837 | "cell_type": "code", 1838 | "source": [ 1839 | "for i in range(0,10,2):\n", 1840 | " print(i)" 1841 | ], 1842 | "execution_count": 105, 1843 | "outputs": [ 1844 | { 1845 | "output_type": "stream", 1846 | "text": [ 1847 | "0\n", 1848 | "2\n", 1849 | "4\n", 1850 | "6\n", 1851 | "8\n" 1852 | ], 1853 | "name": "stdout" 1854 | } 1855 | ] 1856 | }, 1857 | { 1858 | "metadata": { 1859 | "id": "w8llrVvUBBig", 1860 | "colab_type": "text" 1861 | }, 1862 | "cell_type": "markdown", 1863 | "source": [ 1864 | "### list comprehension" 1865 | ] 1866 | }, 1867 | { 1868 | "metadata": { 1869 | "id": "Xw0tYo5YA9aW", 1870 | "colab_type": "code", 1871 | "colab": {} 1872 | }, 1873 | "cell_type": "code", 1874 | "source": [ 1875 | "x = [1,2,3,4]" 1876 | ], 1877 | "execution_count": 0, 1878 | "outputs": [] 1879 | }, 1880 | { 1881 | "metadata": { 1882 | "id": "Mq5SjlDtBFFK", 1883 | "colab_type": "code", 1884 | "colab": { 1885 | "base_uri": "https://localhost:8080/", 1886 | "height": 34 1887 | }, 1888 | "outputId": "14320d77-fa80-4cb3-edfc-f3d5984d4c6d" 1889 | }, 1890 | "cell_type": "code", 1891 | "source": [ 1892 | "out = []\n", 1893 | "\n", 1894 | "for item in x:\n", 1895 | " out.append(item**2)\n", 1896 | "\n", 1897 | "print(out)" 1898 | ], 1899 | "execution_count": 110, 1900 | "outputs": [ 1901 | { 1902 | "output_type": "stream", 1903 | "text": [ 1904 | "[1, 4, 9, 16]\n" 1905 | ], 1906 | "name": "stdout" 1907 | } 1908 | ] 1909 | }, 1910 | { 1911 | "metadata": { 1912 | "id": "TxSTGeWSBIxe", 1913 | "colab_type": "code", 1914 | "colab": { 1915 | "base_uri": "https://localhost:8080/", 1916 | "height": 34 1917 | }, 1918 | "outputId": "d4cf1163-596c-4867-f756-ccf920f17fea" 1919 | }, 1920 | "cell_type": "code", 1921 | "source": [ 1922 | "[item**2 for item in x]" 1923 | ], 1924 | "execution_count": 111, 1925 | "outputs": [ 1926 | { 1927 | "output_type": "execute_result", 1928 | "data": { 1929 | "text/plain": [ 1930 | "[1, 4, 9, 16]" 1931 | ] 1932 | }, 1933 | "metadata": { 1934 | "tags": [] 1935 | }, 1936 | "execution_count": 111 1937 | } 1938 | ] 1939 | }, 1940 | { 1941 | "metadata": { 1942 | "id": "6-tB6Fd-BVq4", 1943 | "colab_type": "text" 1944 | }, 1945 | "cell_type": "markdown", 1946 | "source": [ 1947 | "### functions" 1948 | ] 1949 | }, 1950 | { 1951 | "metadata": { 1952 | "id": "tzy4PAFHBTVT", 1953 | "colab_type": "code", 1954 | "colab": {} 1955 | }, 1956 | "cell_type": "code", 1957 | "source": [ 1958 | "def my_func(param1='default'):\n", 1959 | " \"\"\"\n", 1960 | " Docstring goes here.\n", 1961 | " \"\"\"\n", 1962 | " print(param1)" 1963 | ], 1964 | "execution_count": 0, 1965 | "outputs": [] 1966 | }, 1967 | { 1968 | "metadata": { 1969 | "id": "zMv4gU2kBZ6O", 1970 | "colab_type": "code", 1971 | "colab": { 1972 | "base_uri": "https://localhost:8080/", 1973 | "height": 34 1974 | }, 1975 | "outputId": "a49a3e73-4e11-4da5-98c5-f8c19506c592" 1976 | }, 1977 | "cell_type": "code", 1978 | "source": [ 1979 | "my_func" 1980 | ], 1981 | "execution_count": 113, 1982 | "outputs": [ 1983 | { 1984 | "output_type": "execute_result", 1985 | "data": { 1986 | "text/plain": [ 1987 | "" 1988 | ] 1989 | }, 1990 | "metadata": { 1991 | "tags": [] 1992 | }, 1993 | "execution_count": 113 1994 | } 1995 | ] 1996 | }, 1997 | { 1998 | "metadata": { 1999 | "id": "VP1rX1jVBbl-", 2000 | "colab_type": "code", 2001 | "colab": { 2002 | "base_uri": "https://localhost:8080/", 2003 | "height": 34 2004 | }, 2005 | "outputId": "94abede3-a0ef-4127-df68-beb30c5d0d01" 2006 | }, 2007 | "cell_type": "code", 2008 | "source": [ 2009 | "my_func()" 2010 | ], 2011 | "execution_count": 114, 2012 | "outputs": [ 2013 | { 2014 | "output_type": "stream", 2015 | "text": [ 2016 | "default\n" 2017 | ], 2018 | "name": "stdout" 2019 | } 2020 | ] 2021 | }, 2022 | { 2023 | "metadata": { 2024 | "id": "JAlwqInIBdgi", 2025 | "colab_type": "code", 2026 | "colab": { 2027 | "base_uri": "https://localhost:8080/", 2028 | "height": 34 2029 | }, 2030 | "outputId": "363f0dd4-42df-46a4-ba2a-b72b8e0a98d7" 2031 | }, 2032 | "cell_type": "code", 2033 | "source": [ 2034 | "my_func('new param')" 2035 | ], 2036 | "execution_count": 115, 2037 | "outputs": [ 2038 | { 2039 | "output_type": "stream", 2040 | "text": [ 2041 | "new param\n" 2042 | ], 2043 | "name": "stdout" 2044 | } 2045 | ] 2046 | }, 2047 | { 2048 | "metadata": { 2049 | "id": "-U-D0IdjBhgm", 2050 | "colab_type": "code", 2051 | "colab": { 2052 | "base_uri": "https://localhost:8080/", 2053 | "height": 34 2054 | }, 2055 | "outputId": "4a2a0fc9-4a25-4d6d-a47a-c70bb6c453e4" 2056 | }, 2057 | "cell_type": "code", 2058 | "source": [ 2059 | "my_func(param1='totally new param')" 2060 | ], 2061 | "execution_count": 117, 2062 | "outputs": [ 2063 | { 2064 | "output_type": "stream", 2065 | "text": [ 2066 | "totally new param\n" 2067 | ], 2068 | "name": "stdout" 2069 | } 2070 | ] 2071 | }, 2072 | { 2073 | "metadata": { 2074 | "id": "lYNqQ4SYBvYK", 2075 | "colab_type": "code", 2076 | "colab": {} 2077 | }, 2078 | "cell_type": "code", 2079 | "source": [ 2080 | "def square(x):\n", 2081 | " return x**2" 2082 | ], 2083 | "execution_count": 0, 2084 | "outputs": [] 2085 | }, 2086 | { 2087 | "metadata": { 2088 | "id": "HkC6ln2-B47f", 2089 | "colab_type": "code", 2090 | "colab": { 2091 | "base_uri": "https://localhost:8080/", 2092 | "height": 34 2093 | }, 2094 | "outputId": "3a996cb2-f9bc-4ecb-881f-a71046525977" 2095 | }, 2096 | "cell_type": "code", 2097 | "source": [ 2098 | "square(2)" 2099 | ], 2100 | "execution_count": 120, 2101 | "outputs": [ 2102 | { 2103 | "output_type": "execute_result", 2104 | "data": { 2105 | "text/plain": [ 2106 | "4" 2107 | ] 2108 | }, 2109 | "metadata": { 2110 | "tags": [] 2111 | }, 2112 | "execution_count": 120 2113 | } 2114 | ] 2115 | }, 2116 | { 2117 | "metadata": { 2118 | "id": "ATnOzSi4CBrL", 2119 | "colab_type": "text" 2120 | }, 2121 | "cell_type": "markdown", 2122 | "source": [ 2123 | "### lambda expressions" 2124 | ] 2125 | }, 2126 | { 2127 | "metadata": { 2128 | "id": "lZT-xPt3B73d", 2129 | "colab_type": "code", 2130 | "colab": {} 2131 | }, 2132 | "cell_type": "code", 2133 | "source": [ 2134 | "def times2(var):\n", 2135 | " return var*2" 2136 | ], 2137 | "execution_count": 0, 2138 | "outputs": [] 2139 | }, 2140 | { 2141 | "metadata": { 2142 | "id": "l8JXcWOUCFB-", 2143 | "colab_type": "code", 2144 | "colab": { 2145 | "base_uri": "https://localhost:8080/", 2146 | "height": 34 2147 | }, 2148 | "outputId": "18f457ae-90dd-4bea-b8cd-45e97c8aeedc" 2149 | }, 2150 | "cell_type": "code", 2151 | "source": [ 2152 | "times2(2)" 2153 | ], 2154 | "execution_count": 2, 2155 | "outputs": [ 2156 | { 2157 | "output_type": "execute_result", 2158 | "data": { 2159 | "text/plain": [ 2160 | "4" 2161 | ] 2162 | }, 2163 | "metadata": { 2164 | "tags": [] 2165 | }, 2166 | "execution_count": 2 2167 | } 2168 | ] 2169 | }, 2170 | { 2171 | "metadata": { 2172 | "id": "xdJj0JDyCGbq", 2173 | "colab_type": "code", 2174 | "colab": { 2175 | "base_uri": "https://localhost:8080/", 2176 | "height": 34 2177 | }, 2178 | "outputId": "27148a75-db05-4fc3-d794-74eb22feb4d6" 2179 | }, 2180 | "cell_type": "code", 2181 | "source": [ 2182 | "lambda var: var*2" 2183 | ], 2184 | "execution_count": 3, 2185 | "outputs": [ 2186 | { 2187 | "output_type": "execute_result", 2188 | "data": { 2189 | "text/plain": [ 2190 | ">" 2191 | ] 2192 | }, 2193 | "metadata": { 2194 | "tags": [] 2195 | }, 2196 | "execution_count": 3 2197 | } 2198 | ] 2199 | }, 2200 | { 2201 | "metadata": { 2202 | "id": "WkoFTDVECghK", 2203 | "colab_type": "text" 2204 | }, 2205 | "cell_type": "markdown", 2206 | "source": [ 2207 | "###map and filter" 2208 | ] 2209 | }, 2210 | { 2211 | "metadata": { 2212 | "id": "kIAgqzLOELeq", 2213 | "colab_type": "text" 2214 | }, 2215 | "cell_type": "markdown", 2216 | "source": [ 2217 | "![alt text](https://i.redditmedia.com/u9-PgDOTelaF0DegOH6ax2QSZgw-XdcT27rGdpr_V5M.jpg?fit=crop&crop=faces%2Centropy&arh=2&w=960&s=a9aab85b46ad1528e8e139a4d6fbda17)" 2218 | ] 2219 | }, 2220 | { 2221 | "metadata": { 2222 | "id": "3fEZHcdTCI4i", 2223 | "colab_type": "code", 2224 | "colab": {} 2225 | }, 2226 | "cell_type": "code", 2227 | "source": [ 2228 | "seq = [1,2,3,4,5]" 2229 | ], 2230 | "execution_count": 0, 2231 | "outputs": [] 2232 | }, 2233 | { 2234 | "metadata": { 2235 | "id": "dQgDAqeWEX_x", 2236 | "colab_type": "code", 2237 | "colab": { 2238 | "base_uri": "https://localhost:8080/", 2239 | "height": 34 2240 | }, 2241 | "outputId": "a8bf8dca-ae23-4d8b-b099-b44b90dd77be" 2242 | }, 2243 | "cell_type": "code", 2244 | "source": [ 2245 | "map(times2,seq)" 2246 | ], 2247 | "execution_count": 5, 2248 | "outputs": [ 2249 | { 2250 | "output_type": "execute_result", 2251 | "data": { 2252 | "text/plain": [ 2253 | "" 2254 | ] 2255 | }, 2256 | "metadata": { 2257 | "tags": [] 2258 | }, 2259 | "execution_count": 5 2260 | } 2261 | ] 2262 | }, 2263 | { 2264 | "metadata": { 2265 | "id": "0PY9cnKuEalM", 2266 | "colab_type": "code", 2267 | "colab": { 2268 | "base_uri": "https://localhost:8080/", 2269 | "height": 34 2270 | }, 2271 | "outputId": "62b27ff4-b297-46c8-df93-6cf9181086d1" 2272 | }, 2273 | "cell_type": "code", 2274 | "source": [ 2275 | "list(map(times2,seq))" 2276 | ], 2277 | "execution_count": 7, 2278 | "outputs": [ 2279 | { 2280 | "output_type": "execute_result", 2281 | "data": { 2282 | "text/plain": [ 2283 | "[2, 4, 6, 8, 10]" 2284 | ] 2285 | }, 2286 | "metadata": { 2287 | "tags": [] 2288 | }, 2289 | "execution_count": 7 2290 | } 2291 | ] 2292 | }, 2293 | { 2294 | "metadata": { 2295 | "id": "FgIen4WgEb4r", 2296 | "colab_type": "code", 2297 | "colab": { 2298 | "base_uri": "https://localhost:8080/", 2299 | "height": 34 2300 | }, 2301 | "outputId": "aeed8ac8-013a-47af-8f3d-aaa06b7e98c6" 2302 | }, 2303 | "cell_type": "code", 2304 | "source": [ 2305 | "list(map(lambda var: var*2,seq))" 2306 | ], 2307 | "execution_count": 9, 2308 | "outputs": [ 2309 | { 2310 | "output_type": "execute_result", 2311 | "data": { 2312 | "text/plain": [ 2313 | "[2, 4, 6, 8, 10]" 2314 | ] 2315 | }, 2316 | "metadata": { 2317 | "tags": [] 2318 | }, 2319 | "execution_count": 9 2320 | } 2321 | ] 2322 | }, 2323 | { 2324 | "metadata": { 2325 | "id": "TFSFfya1EdYM", 2326 | "colab_type": "code", 2327 | "colab": { 2328 | "base_uri": "https://localhost:8080/", 2329 | "height": 34 2330 | }, 2331 | "outputId": "d43e5307-6c9c-41c7-9436-68108e903e87" 2332 | }, 2333 | "cell_type": "code", 2334 | "source": [ 2335 | "filter(lambda item: item%2 == 0,seq)" 2336 | ], 2337 | "execution_count": 48, 2338 | "outputs": [ 2339 | { 2340 | "output_type": "execute_result", 2341 | "data": { 2342 | "text/plain": [ 2343 | "" 2344 | ] 2345 | }, 2346 | "metadata": { 2347 | "tags": [] 2348 | }, 2349 | "execution_count": 48 2350 | } 2351 | ] 2352 | }, 2353 | { 2354 | "metadata": { 2355 | "id": "Y9rJh8s5Ga5K", 2356 | "colab_type": "code", 2357 | "colab": { 2358 | "base_uri": "https://localhost:8080/", 2359 | "height": 34 2360 | }, 2361 | "outputId": "44d12844-d163-4555-bbda-b8c234c834a5" 2362 | }, 2363 | "cell_type": "code", 2364 | "source": [ 2365 | "list(filter(lambda item: item%2 == 0,seq))" 2366 | ], 2367 | "execution_count": 49, 2368 | "outputs": [ 2369 | { 2370 | "output_type": "execute_result", 2371 | "data": { 2372 | "text/plain": [ 2373 | "[2, 4]" 2374 | ] 2375 | }, 2376 | "metadata": { 2377 | "tags": [] 2378 | }, 2379 | "execution_count": 49 2380 | } 2381 | ] 2382 | }, 2383 | { 2384 | "metadata": { 2385 | "id": "Gnhjh8bcGpi0", 2386 | "colab_type": "text" 2387 | }, 2388 | "cell_type": "markdown", 2389 | "source": [ 2390 | "### Methods" 2391 | ] 2392 | }, 2393 | { 2394 | "metadata": { 2395 | "id": "mgqNyLqHGmYL", 2396 | "colab_type": "code", 2397 | "colab": {} 2398 | }, 2399 | "cell_type": "code", 2400 | "source": [ 2401 | "st = 'hello my name is Sam'" 2402 | ], 2403 | "execution_count": 0, 2404 | "outputs": [] 2405 | }, 2406 | { 2407 | "metadata": { 2408 | "id": "Q1MpXkDKG0Io", 2409 | "colab_type": "code", 2410 | "colab": { 2411 | "base_uri": "https://localhost:8080/", 2412 | "height": 34 2413 | }, 2414 | "outputId": "ce008780-4098-42bf-d7e2-59ec3936feb7" 2415 | }, 2416 | "cell_type": "code", 2417 | "source": [ 2418 | "st.lower()" 2419 | ], 2420 | "execution_count": 51, 2421 | "outputs": [ 2422 | { 2423 | "output_type": "execute_result", 2424 | "data": { 2425 | "text/plain": [ 2426 | "'hello my name is sam'" 2427 | ] 2428 | }, 2429 | "metadata": { 2430 | "tags": [] 2431 | }, 2432 | "execution_count": 51 2433 | } 2434 | ] 2435 | }, 2436 | { 2437 | "metadata": { 2438 | "id": "6c5Wq4hRG5VY", 2439 | "colab_type": "code", 2440 | "colab": { 2441 | "base_uri": "https://localhost:8080/", 2442 | "height": 34 2443 | }, 2444 | "outputId": "381d35d6-e11e-4209-9c4f-85ed38c0bade" 2445 | }, 2446 | "cell_type": "code", 2447 | "source": [ 2448 | "st.upper()" 2449 | ], 2450 | "execution_count": 52, 2451 | "outputs": [ 2452 | { 2453 | "output_type": "execute_result", 2454 | "data": { 2455 | "text/plain": [ 2456 | "'HELLO MY NAME IS SAM'" 2457 | ] 2458 | }, 2459 | "metadata": { 2460 | "tags": [] 2461 | }, 2462 | "execution_count": 52 2463 | } 2464 | ] 2465 | }, 2466 | { 2467 | "metadata": { 2468 | "id": "rMYtZHloG9ux", 2469 | "colab_type": "code", 2470 | "colab": { 2471 | "base_uri": "https://localhost:8080/", 2472 | "height": 34 2473 | }, 2474 | "outputId": "793686f4-30cf-44a8-c247-98c5affb5974" 2475 | }, 2476 | "cell_type": "code", 2477 | "source": [ 2478 | "st.split()" 2479 | ], 2480 | "execution_count": 53, 2481 | "outputs": [ 2482 | { 2483 | "output_type": "execute_result", 2484 | "data": { 2485 | "text/plain": [ 2486 | "['hello', 'my', 'name', 'is', 'Sam']" 2487 | ] 2488 | }, 2489 | "metadata": { 2490 | "tags": [] 2491 | }, 2492 | "execution_count": 53 2493 | } 2494 | ] 2495 | }, 2496 | { 2497 | "metadata": { 2498 | "id": "6Y3iFDEqHATy", 2499 | "colab_type": "code", 2500 | "colab": {} 2501 | }, 2502 | "cell_type": "code", 2503 | "source": [ 2504 | "tweet = 'Go Sports! #Sports'" 2505 | ], 2506 | "execution_count": 0, 2507 | "outputs": [] 2508 | }, 2509 | { 2510 | "metadata": { 2511 | "id": "dTqhXCU9HEAH", 2512 | "colab_type": "code", 2513 | "colab": { 2514 | "base_uri": "https://localhost:8080/", 2515 | "height": 34 2516 | }, 2517 | "outputId": "2460d777-698e-4284-a264-7936169674c5" 2518 | }, 2519 | "cell_type": "code", 2520 | "source": [ 2521 | "tweet.split('#')" 2522 | ], 2523 | "execution_count": 55, 2524 | "outputs": [ 2525 | { 2526 | "output_type": "execute_result", 2527 | "data": { 2528 | "text/plain": [ 2529 | "['Go Sports! ', 'Sports']" 2530 | ] 2531 | }, 2532 | "metadata": { 2533 | "tags": [] 2534 | }, 2535 | "execution_count": 55 2536 | } 2537 | ] 2538 | }, 2539 | { 2540 | "metadata": { 2541 | "id": "cTzaRYqmHJkD", 2542 | "colab_type": "code", 2543 | "colab": { 2544 | "base_uri": "https://localhost:8080/", 2545 | "height": 34 2546 | }, 2547 | "outputId": "c825cbe4-4495-446b-a427-dddd4cd3316b" 2548 | }, 2549 | "cell_type": "code", 2550 | "source": [ 2551 | "tweet.split('#')[1]" 2552 | ], 2553 | "execution_count": 58, 2554 | "outputs": [ 2555 | { 2556 | "output_type": "execute_result", 2557 | "data": { 2558 | "text/plain": [ 2559 | "'Sports'" 2560 | ] 2561 | }, 2562 | "metadata": { 2563 | "tags": [] 2564 | }, 2565 | "execution_count": 58 2566 | } 2567 | ] 2568 | }, 2569 | { 2570 | "metadata": { 2571 | "id": "DkqWJekHHOMu", 2572 | "colab_type": "code", 2573 | "colab": { 2574 | "base_uri": "https://localhost:8080/", 2575 | "height": 34 2576 | }, 2577 | "outputId": "ade609fe-ee53-4a2b-d3ce-c4f208b3ac09" 2578 | }, 2579 | "cell_type": "code", 2580 | "source": [ 2581 | "d" 2582 | ], 2583 | "execution_count": 59, 2584 | "outputs": [ 2585 | { 2586 | "output_type": "execute_result", 2587 | "data": { 2588 | "text/plain": [ 2589 | "{'key1': 'item1', 'key2': 'item2'}" 2590 | ] 2591 | }, 2592 | "metadata": { 2593 | "tags": [] 2594 | }, 2595 | "execution_count": 59 2596 | } 2597 | ] 2598 | }, 2599 | { 2600 | "metadata": { 2601 | "id": "ZQBceDOYHbX6", 2602 | "colab_type": "code", 2603 | "colab": { 2604 | "base_uri": "https://localhost:8080/", 2605 | "height": 34 2606 | }, 2607 | "outputId": "332f78ea-6f6b-47f9-925f-e612f1d70e2f" 2608 | }, 2609 | "cell_type": "code", 2610 | "source": [ 2611 | "d.keys()" 2612 | ], 2613 | "execution_count": 60, 2614 | "outputs": [ 2615 | { 2616 | "output_type": "execute_result", 2617 | "data": { 2618 | "text/plain": [ 2619 | "dict_keys(['key1', 'key2'])" 2620 | ] 2621 | }, 2622 | "metadata": { 2623 | "tags": [] 2624 | }, 2625 | "execution_count": 60 2626 | } 2627 | ] 2628 | }, 2629 | { 2630 | "metadata": { 2631 | "id": "IuriVOx8HdzW", 2632 | "colab_type": "code", 2633 | "colab": { 2634 | "base_uri": "https://localhost:8080/", 2635 | "height": 34 2636 | }, 2637 | "outputId": "51f1232b-8121-4ae7-dcc8-59f0e4e17953" 2638 | }, 2639 | "cell_type": "code", 2640 | "source": [ 2641 | "d.items()" 2642 | ], 2643 | "execution_count": 61, 2644 | "outputs": [ 2645 | { 2646 | "output_type": "execute_result", 2647 | "data": { 2648 | "text/plain": [ 2649 | "dict_items([('key1', 'item1'), ('key2', 'item2')])" 2650 | ] 2651 | }, 2652 | "metadata": { 2653 | "tags": [] 2654 | }, 2655 | "execution_count": 61 2656 | } 2657 | ] 2658 | }, 2659 | { 2660 | "metadata": { 2661 | "id": "cOSP4EJoHoUD", 2662 | "colab_type": "code", 2663 | "colab": {} 2664 | }, 2665 | "cell_type": "code", 2666 | "source": [ 2667 | "lst = [1,2,3]" 2668 | ], 2669 | "execution_count": 0, 2670 | "outputs": [] 2671 | }, 2672 | { 2673 | "metadata": { 2674 | "id": "Cu0KJRXuHqji", 2675 | "colab_type": "code", 2676 | "colab": { 2677 | "base_uri": "https://localhost:8080/", 2678 | "height": 34 2679 | }, 2680 | "outputId": "17e053b1-ad35-4d41-e0ec-06431a9e97c6" 2681 | }, 2682 | "cell_type": "code", 2683 | "source": [ 2684 | "lst.pop()" 2685 | ], 2686 | "execution_count": 64, 2687 | "outputs": [ 2688 | { 2689 | "output_type": "execute_result", 2690 | "data": { 2691 | "text/plain": [ 2692 | "3" 2693 | ] 2694 | }, 2695 | "metadata": { 2696 | "tags": [] 2697 | }, 2698 | "execution_count": 64 2699 | } 2700 | ] 2701 | }, 2702 | { 2703 | "metadata": { 2704 | "id": "3xIZwjgtHtcX", 2705 | "colab_type": "code", 2706 | "colab": { 2707 | "base_uri": "https://localhost:8080/", 2708 | "height": 34 2709 | }, 2710 | "outputId": "de623085-af76-48e6-b2f0-565cab157250" 2711 | }, 2712 | "cell_type": "code", 2713 | "source": [ 2714 | "lst" 2715 | ], 2716 | "execution_count": 65, 2717 | "outputs": [ 2718 | { 2719 | "output_type": "execute_result", 2720 | "data": { 2721 | "text/plain": [ 2722 | "[1, 2]" 2723 | ] 2724 | }, 2725 | "metadata": { 2726 | "tags": [] 2727 | }, 2728 | "execution_count": 65 2729 | } 2730 | ] 2731 | }, 2732 | { 2733 | "metadata": { 2734 | "id": "kaRcL_epH0Ql", 2735 | "colab_type": "code", 2736 | "colab": { 2737 | "base_uri": "https://localhost:8080/", 2738 | "height": 34 2739 | }, 2740 | "outputId": "91aa8892-0e12-46bb-b1dd-3e697ddb0756" 2741 | }, 2742 | "cell_type": "code", 2743 | "source": [ 2744 | "'x' in [1,2,3]" 2745 | ], 2746 | "execution_count": 66, 2747 | "outputs": [ 2748 | { 2749 | "output_type": "execute_result", 2750 | "data": { 2751 | "text/plain": [ 2752 | "False" 2753 | ] 2754 | }, 2755 | "metadata": { 2756 | "tags": [] 2757 | }, 2758 | "execution_count": 66 2759 | } 2760 | ] 2761 | }, 2762 | { 2763 | "metadata": { 2764 | "id": "_0VwoX94H_HP", 2765 | "colab_type": "code", 2766 | "colab": { 2767 | "base_uri": "https://localhost:8080/", 2768 | "height": 34 2769 | }, 2770 | "outputId": "840b5166-670b-483a-dc15-2f2d640ed968" 2771 | }, 2772 | "cell_type": "code", 2773 | "source": [ 2774 | "'x' in ['x','y','z']" 2775 | ], 2776 | "execution_count": 67, 2777 | "outputs": [ 2778 | { 2779 | "output_type": "execute_result", 2780 | "data": { 2781 | "text/plain": [ 2782 | "True" 2783 | ] 2784 | }, 2785 | "metadata": { 2786 | "tags": [] 2787 | }, 2788 | "execution_count": 67 2789 | } 2790 | ] 2791 | }, 2792 | { 2793 | "metadata": { 2794 | "id": "_Limhh_aIHc0", 2795 | "colab_type": "text" 2796 | }, 2797 | "cell_type": "markdown", 2798 | "source": [ 2799 | "# Great Job !" 2800 | ] 2801 | } 2802 | ] 2803 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) 2 | # Machine Learning Crash Course Starter Guide 3 | 4 | 5 | ![MLCC](https://i2.wp.com/9to5google.com/wp-content/uploads/sites/4/2018/07/google-machine-learning-crash-course.jpg?resize=1024%2C0&quality=82&strip=all&ssl=1) 6 | 7 | This guide provides technical and mathematical background required for Google's [Machine Learning Crash Course(MLCC)](http://g.co/mledu/studyjams-IN) to beginners. 8 | 9 | ## Why? 10 | MLCC is great but sometimes people get stuck for weeks just because they don't have basic background in mathematics and python required for MLCC. Here we're trying to help you kickstart your journey with Machine Learning. 11 | 12 | ## How to use this guide? 13 | You can either download whole repository and access it offline using [Jupyter notebook](https://jupyter.org/install.html), which comes preinstalled with [Anaconda](https://www.anaconda.com/distribution/#download-section). 14 | **OR** you can access notebooks using `View in Colaboratory` link in the starting of notebooks. 15 | 16 | ## Found this guide helpful? 17 | Then please give a star and contribute to make it more informative. 18 | 19 | ## Progress 20 | - [X] Math 21 | - [X] Basic Python iPython Notebook 22 | - [X] Advance Python iPython Notebook (numpy, matplotlib, seaborn) 23 | 24 | ## Future Goals 25 | - [ ] Basic ML algorithms with practical examples 26 | - [ ] Case studies 27 | - [ ] Deploying ML models 28 | 29 | 30 | ## Source 31 | We are very thankful to amazing teachers and educators from all around the world. Major resources used to create this guide: 32 | - [Khan Academy](https://www.khanacademy.org/) 33 | - [Math is Fun](http://mathsisfun.com/) 34 | 35 | Note: If your content is used here, please feel free to mail me at pratik97.work@gmail.com to add your name / organization name in this list. 36 | 37 | ## I wanna add a topic to this guide, how to submit it? 38 | Please checkout the [list of issues](https://github.com/HackyRoot/MLCC_Starter_Guide/issues/) and create an issue, if it's not there. 39 | You can submit a [Pull Request](https://github.com/HackyRoot/MLCC_Starter_Guide/pulls), if you've something to share with the community. 40 | 41 | 42 | Good Luck 43 | 44 | ***Keep Coding... Keep Rocking...*** 45 | 46 | --------------------------------------------------------------------------------