diff --git a/beginners-guide/01-begin-python-programming.ipynb b/beginners-guide/01-begin-python-programming.ipynb index 00e97f0..41ce512 100644 --- a/beginners-guide/01-begin-python-programming.ipynb +++ b/beginners-guide/01-begin-python-programming.ipynb @@ -4998,13 +4998,6 @@ "mat.T" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -5020,17 +5013,22 @@ "You can store any object into a variable.\n", "\n", "### Comparisons\n", - "- **==**\n", - "- **!=**\n", - "- **<**\n", - "- **>** \n", - "- **<=**\n", - "- **>=**\n", + "- `==`\n", + "- `!=`\n", + "- `<`\n", + "- `>`\n", + "- `<=`\n", + "- `>=`\n", + "\n", + "##### Boolean operators\n", + "- `and`\n", + "- `or`\n", + "- `not`\n", "\n", "\n", "### Some collections\n", - "- **list** : `[1, 2, 3, 4]`\n", - "- **tuple** : `(1, 2, 3, 4)`\n", + "- **list** : `[1, 2, 3, 1]`\n", + "- **tuple** : `(1, 2, 3, 1)`\n", "- **set** : `{1, 2, 3}`\n", "- **dict** : `{'a':1, 'b':2, 'c':3}`\n", "\n", @@ -5039,45 +5037,57 @@ "\n", "Lists are mutable, tuples are immutable, sets have no order and contain only unique elements, dicts store key-value pairs. Collections can also be collections of collections. \n", "\n", - "\n", - "Python objects have associated methods which let's you modify or otherwise perform operations on them.\n", - "\n", + "##### check if a collection contains some value, a:\n", + "- `a in my_collection`\n", "\n", "\n", "### Loops\n", - "- **For loops** : loops through elements in an iterable\n", - "- **While loops** : repeats indefinately as long as some criteria is met\n", + "- **For loops** : loops through elements in an iterable (predefined n)\n", + "- **While loops** : repeats indefinitely as long as some criteria is met\n", + "\n", + "##### List comprehensions\n", + "- a more compact and more readable way of implementing (and storing values generated in) a loop\n", "\n", "### Control flow\n", "- **if**\n", "- **else**\n", "- **elif**\n", "\n", - "Executes a block of code only if some criterion is met. \n", + "Let's you set up criteria for whether or not to execute some code. \n", + " \n", "\n", "### Functions\n", - "\n", "- **def** keyword\n", "- **return** keyword\n", "\n", - "Functions may or may not take arguments. The `return` keyword is not mandatory (if absent, the function returns `None`.\n", + "Functions may or may not take arguments. The `return` keyword is not mandatory (if absent, the function returns `None`. You can store the return value of a function in a variable.\n", + "\n", + "### Classes\n", + "- **methods:** functions tailored for that object.\n", + "- **attributes:** features of an object.\n", "\n", + "A class is a blueprint for making an object, with some predefined behaviour.\n", "\n", + "### Libraries\n", + "- `import library`\n", + "- `import library as lib`\n", + "- `from library import function/module`\n", + "\n", + "- **numpy, pandas, matplotlib, sklearn...**\n", + "\n", + "The space of libraries in Python is vast, and highly specialized. Make good use of them: don't reinvent the wheel. \n", "\n", "\n", "#### Other things to keep in mind:\n", "- *Indentations are important: 4 spaces*\n", "- *Python counts from 0*\n", - "- *Make use of the \n", + "- *Make use of the python debugger* \n", "- *Google is your friend*\n", "- *Play around with complicated code to better understand what it does*\n", - "- *Make use of the offical docs (using `??` after)*\n", - "\n", - "Let's you set up criteria for whether or not to execute some code. \n", + "- *Make use of the offical docs (using `??` after a function or object)*\n", "\n", "\n", - "Almost all modern programming languages contain these fundamentals. \n", - "\n" + "With a firm understanding of these building blocks, you can write fairly complex programs." ] }, {