Skip to content

Commit

Permalink
basics
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Sep 24, 2019
1 parent 80ba8fd commit 1e86f9b
Show file tree
Hide file tree
Showing 22 changed files with 1,853 additions and 476 deletions.
861 changes: 861 additions & 0 deletions exercises/basics/basics-solution.ipynb

Large diffs are not rendered by default.

Binary file added exercises/basics/img/comparators.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/escapes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/genetic_code.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/keywords.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/precedence.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/slicestring.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/slicingstring.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/stringoperators.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/strmethods.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/basics/img/types.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 40 additions & 20 deletions exercises/introduction/introduction-solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,27 @@
"\n",
"### Windows/Mac installation \n",
"\n",
"To avoid hassles, especially on Win / Mac you should install some so called _package manager_ (Linux distributions already come with a package manager). Among the many options for this course we use the package manager Anaconda for Python 3.6. \n",
"To avoid hassles, especially on Win / Mac you should install some so called _package manager_ (Linux distributions already come with a package manager). Among the many options for this course we use the package manager Anaconda for Python 3.7. \n",
"\n",
"\n",
"1. Install [Anaconda for Python 3.6](https://www.anaconda.com/download/) (anaconda installer will ask you to install also visual studio code, so accept the kind offer)\n",
"1. Install [Anaconda for Python 3.7](https://www.anaconda.com/download/) (anaconda installer will ask you to install also visual studio code, so accept the kind offer)\n",
"\n",
"2. If you didn't in the previous point, install now Visual Studio Code, which is available for all platforms. You can read about it [here](https://code.visualstudio.com/). Downloads for all platforms can be found [here](https://code.visualstudio.com/Download) \n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Linux installation \n",
"\n",
"Although you can install Anaconda on Linux, it is usually better to use the system package manager that comes with your distribution. \n",
"\n",
"1. Check the Python interpreter - most probably you already have one in your distribution, but you have to check it is the right version. In this course we will use python version 3.x. Open a terminal and try typing in:\n",
"\n",
"```\n",
"```bash\n",
"python3\n",
"```\n",
"\n",
Expand All @@ -75,20 +81,32 @@
"\n",
"![](img/console.png)\n",
"\n",
"you are already sorted, just type Ctrl-D to exit.\n",
"you are already sorted, just type `Ctrl-D` to exit. If it doesn't work, try typing `exit()` and hit Enter\n",
"\n",
"Otherwise you need to install Python 3. Installation on a debian-like linux distribution (e.g. Ubuntu) can be done by typing the following commands on a terminal:\n",
"Otherwise you need to install Python 3. \n",
"\n",
"```sudo apt-get update```\n",
"**Linux, debian-like(e.g. Ubuntu)**\n",
"\n",
"```sudo apt-get install python3```\n",
"Issue the following commands on a terminal:\n",
"\n",
"While **if you are using Fedora** you can use:\n",
"```bash\n",
"sudo apt-get update\n",
"```\n",
"\n",
"```bash\n",
"sudo apt-get install python3\n",
"```\n",
"\n",
"```sudo dnf install python3```\n",
"**Linux Fedora**:\n",
"\n",
"Issue the following commands on a terminal:\n",
"\n",
"```bash\n",
"sudo dnf install python3\n",
"```\n",
" \n",
"\n",
"2. Install now the package manager pip, which is a very convenient tool to install python packages, with the following command (**on Fedora the command above should have already installed it**):\n",
"2. Install now the package manager `pip`, which is a very convenient tool to install python packages, with the following command (**on Fedora the command above should have already installed it**):\n",
" \n",
" ```sudo apt-get install python3-pip```\n",
" \n",
Expand Down Expand Up @@ -144,7 +162,7 @@
"**WARNING**: In the _system_ console we are entering commands _for the operating system_, using the _system command language_ which varies for each operating system. So following commands are not Python !\n",
"</div>\n",
"\n",
"- to see files of the folder you are in you can type `dir` in windows and `ls` in Mac/Linx\n",
"- to see files of the folder you are in you can type `dir` in windows and `ls` in Mac/Linux\n",
"- to enter a folder: `cd MYFOLDER`\n",
"- to leave a folder: `cd ..`\n",
" - mind the space between cd and two dots\n",
Expand Down Expand Up @@ -596,6 +614,8 @@
"\n",
"If you have Anaconda:\n",
"\n",
"Open Anaconda Prompt, and type:\n",
"\n",
"```bash\n",
"conda install -c conda-forge jupyter_contrib_nbextensions \n",
"```\n",
Expand Down Expand Up @@ -730,14 +750,14 @@
" <iframe\n",
" width=\"900\"\n",
" height=\"300\"\n",
" src=\"https://pythontutor.com/iframe-embed.html#curInstr=0&py=3&code=x+%3D+5%0Ay%3D+7%0Az+%3D+x+%2B+y%0A%0A&cumulative=false\"\n",
" src=\"https://pythontutor.com/iframe-embed.html#code=x+%3D+5%0Ay%3D+7%0Az+%3D+x+%2B+y%0A%0A&cumulative=false&py=3&curInstr=0\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f64402f7828>"
"<IPython.lib.display.IFrame at 0x7f47fc2fb5f8>"
]
},
"execution_count": 10,
Expand Down Expand Up @@ -781,14 +801,14 @@
" <iframe\n",
" width=\"900\"\n",
" height=\"225\"\n",
" src=\"https://pythontutor.com/iframe-embed.html#curInstr=0&py=3&code=x+%3D++w+%2B+5%0A&cumulative=false\"\n",
" src=\"https://pythontutor.com/iframe-embed.html#code=x+%3D++w+%2B+5%0A&cumulative=false&py=3&curInstr=0\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f64402f74a8>"
"<IPython.lib.display.IFrame at 0x7f47fc202e48>"
]
},
"execution_count": 12,
Expand Down Expand Up @@ -892,9 +912,9 @@
"metadata": {},
"source": [
"\n",
"4. If you have not done so already, put the two previous scripts in two separate files (e.g. triangle_area.py and square_area.py and execute them from the terminal).\n",
"4. If you have not done so already, put the two previous scripts in two separate files (e.g. `triangle_area.py` and `square_area.py` and execute them from the terminal).\n",
"\n",
"5. Write a small script (trapezoid.py) that computes the area of a trapezoid having major base (MB) equal to 30 units, minor base (mb) equal to 12 and height (H) equal to 17. Print the resulting area. Try executing the script from inside Visual Studio Code and from the terminal.\n"
"5. Write a small script (`trapezoid.py`) that computes the area of a trapezoid having major base (MB) equal to 30 units, minor base (mb) equal to 12 and height (H) equal to 17. Print the resulting area. Try executing the script from inside Visual Studio Code and from the terminal.\n"
]
},
{
Expand Down Expand Up @@ -1025,7 +1045,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.7.3"
},
"toc": {
"base_numbering": 1,
Expand All @@ -1038,7 +1058,7 @@
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
"toc_window_display": true
}
},
"nbformat": 4,
Expand Down
Binary file added exercises/strings/img/escapes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/strings/img/slicestring.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/strings/img/slicingstring.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/strings/img/stringoperators.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added exercises/strings/img/strmethods.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1e86f9b

Please sign in to comment.