Skip to content

Commit

Permalink
minor tweaks, added summary
Browse files Browse the repository at this point in the history
  • Loading branch information
lillepeder committed Aug 7, 2020
1 parent a994170 commit 578e741
Showing 1 changed file with 39 additions and 29 deletions.
68 changes: 39 additions & 29 deletions beginners-guide/01-begin-python-programming.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4998,13 +4998,6 @@
"mat.T"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -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",
Expand All @@ -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."
]
},
{
Expand Down

0 comments on commit 578e741

Please sign in to comment.