LUNAR
π
Dashboard
Browse
SW01_Auftrag_en
JUPYTER
View Source
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Assignment work SW01 - PYTHON BASICS \n", "\n", "These are the self-study tasks for the semester week, which you will solve within a week in your JupyterHub environment. After completing your work, download a copy of the Jupyter notebook file locally to your laptop (right-click on the file in the JupyterHub file browser -> Download).\n", "\n", "On ILIAS you will find the corresponding scheduled work assignments every week, where you will upload your solved Jupyter notebook file. After you have submitted your work, you will receive a corresponding sample solution for the work assignment. Your submission will not be corrected. Although the work assignments are marked \"mandatory\", there are no tests in the module. The grades from the tests during the semester count.\n", "\n", "We wish you much success!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*** \n", "## 1. Task - first steps with the JupyterNotebook environment \n", "\n", "- In your Jupyter environment, create a new folder called \"Temp\" in the Explorer on the left.\n", "- In this folder, create a new JupyterNotebook and give it the title \"hw\". Verify that the file has the extension .jypnb.\n", "- Close your development environment and then reopen it. Is the file \"hw.jpynb\" still there? -> Your files are saved for you in your environment. (Note: Deleting them will not bring them back).\n", "\n", "- Create a new line of code in your file and write your first \"hello world\" with the print command.\n", "- Then return to this file and solve the remaining tasks." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*** \n", "## 2. Task - Markdown cells \n", "Create a new **Markdown window** below this instruction here.\n", "\n", "Write in this window:\n", "- A sub-subtitle (3rd order) with \"My solution to the 2nd task\"\n", "- below the title your name, the date and your email address\n", "- Write your name in bold and the date in italics\n", "- Can you add a picture?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### My solution to the 2nd task\n", "\n", "**Marcus Kron**,\n", "*19.09.2024*,\n", "marcus.kron@stud.hslu.ch\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*** \n", "## 3. Task - Code cells \n", "### 3.1 John Travolta \n", "Insert a new **Code cell** below this Markdown cell.\n", "\n", "Write the following Python code in it (you can also use other names)\n", "\n", "```Python\n", "surname = \"John\"\n", "name = \"Travolta\"\n", "print(name + surname)\n", "```\n", "\n", "Run your code (with the triangle icon above or Shift+Enter)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "GreggioEzio\n" ] } ], "source": [ "surname = \"Ezio\"\n", "name = \"Greggio\"\n", "print(name + surname)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3.2 Comments on John Travolta \n", "\n", "- Create a **comment block** in front of your code. Describe the function of the above code using the ``print()`` command.\n", "\n", "- Put a **comment line** in front of the ``print()`` command and briefly describe the function of the ``+`` operator." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " βnameβ and βsurnameβ are two variables which were defined with a parameter through the symbol β=β \n", "EzioGreggio\n" ] } ], "source": [ "print(\" βnameβ and βsurnameβ are two variables which were defined with a parameter through the symbol β=β \")\n", "\n", "surname = \"Ezio\"\n", "name = \"Greggio\"\n", "\n", "# The β+β operator inside the print() command allows you to print the sum of the variables you want to print on the screen\n", "print(surname + name)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*** \n", "## 4. Task - Python for kids \n", "### 4.1 New Jupyter Notebook File \n", "\n", "- In your Jupyter environment, create a new folder called \"Varia\" in the Explorer on the left.\n", "- In the folder, create a new JupyterNotebook and give it the file name \"p4k\". Verify that the file has the extension .jypnb.\n", "- Close your development environment and then reopen it. Is the file \"p4k.jpynb\" still there? -> Your files are saved there. Deleting a file will not bring them back!\n", "\n", "- On [Python for kids](https://pythonbuch.com/aufgabensammlung.html) copy a simple example into your p4k notebook as a code cell.\n", "- Put a Markdown cell in front of the code and add your name, date and author.\n", "- Run your code" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*** \n", "end \n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.12.4" } }, "nbformat": 4, "nbformat_minor": 4 }