{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/plain": [
""
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML(''.format(open('../css/cowi.css').read()))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 0. Basic Exercises\n",
"These exercises are tiny appetizers for next time. \n",
"\n",
"Use a locally installed editor like Spyder or Visual Studio Code. If you want to try out coding without installing anything, try this online editor: https://www.onlinegdb.com/online_python_compiler\n",
"\n",
"# Exercise 0\n",
"If you haven't done so yet, go ahead and create your first little program and type `print('Hello world!')`. \n",
"\n",
"# Exercise 1\n",
"Use Python to perform and print the result of these arithmetic operations:\n",
"\n",
"* $2+2$\n",
"* $2^3$\n",
"* $\\dfrac{2}{5}$\n",
"* $2 \\cdot 3 + \\dfrac{\\dfrac{7}{1000}}{10^3}$\n",
"\n",
"Defining the expressions and running the code will not show any output. It has to be explicitly **printed**.\n",
"\n",
"To print results, use the `print()` function. The expression to be printed goes inside the parentheses.\n",
"\n",
"> **Note:** Exponentiation in Python is done by double asterisk `**` and not `^`.\n",
"\n",
"# Exercise 2\n",
"Save the results from Exercise 1 to variables called `a`, `b`, `c` and `d`, respectively. A variable is created an the assignment operator `=`, just like in math. \n",
"\n",
"Now, print the expressions from above by referencing the variable names instead. \n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
}
},
"nbformat": 4,
"nbformat_minor": 2
}