{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Template for exercise solutions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Remove this heading*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## MDG Python course – Summer 2020\n", "\n", "### Exercise A1 – Solutions\n", "\n", "##### Handed in by Jane Doe" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__1__ Get your hands on a working installation of Python 3, install Jupyter, and open the exercise solution template. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Task 1 is completed successfully as this notebook is running.*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__2__ Repeat the problem asked, so nobody has to look up the question for the following answer." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If your answer includes text, put it here. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can include inline math in your answer: $1 + 1 = 2$ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or display style math:\n", "$$\n", "F = \\frac{q^2}{4\\pi\\epsilon_0r^2}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Include Python code snippets in code cells:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "new_value = 1 # Comment your code where appropriate\n", "\n", "def user_function(*args):\n", " \"\"\"In particular comment what your functions do\n", " \n", " Args:\n", " args: Takes an arbitrary number of arguments of any type.\n", " \n", " Returns:\n", " The number of arguments passed\n", " \"\"\"\n", " \n", " return len(args)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3\n" ] } ], "source": [ "print(\n", " user_function(new_value, 1, True)\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.8.2" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": { "height": "calc(100% - 180px)", "left": "10px", "top": "150px", "width": "263.6px" }, "toc_section_display": true, "toc_window_display": true }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }