3. Vorlesung

This commit is contained in:
DerGrumpf 2024-11-01 13:40:56 +01:00
parent 13b7ae6a6e
commit 5258c080bb
20 changed files with 28984 additions and 716 deletions

4
.obsidian/templates.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"folder": "Template",
"dateFormat": "DD.MM.YYYY"
}

View File

@ -41,16 +41,58 @@
"state": {
"type": "markdown",
"state": {
"file": "Lectures/17 21.02.2025.md",
"file": "Template/Gruppe.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "17 21.02.2025"
"title": "Gruppe"
}
},
{
"id": "91e68fc77697e0f9",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Gruppen/MeWi 1.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "MeWi 1"
}
},
{
"id": "d4d973e0d0e2e072",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Gruppen/MeWi 2.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "MeWi 2"
}
},
{
"id": "91b08793b1132c55",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Lectures/03 01.11.2024.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "03 01.11.2024"
}
}
],
"currentTab": 2
"currentTab": 5
}
],
"direction": "vertical"
@ -213,23 +255,42 @@
"table-editor-obsidian:Advanced Tables Toolbar": false
}
},
"active": "a5dbdd4d7f31f3f3",
"active": "91b08793b1132c55",
"lastOpenFiles": [
"Lectures/16 14.02.2025.md",
"Lectures/17 21.02.2025.md",
"Material/3.Vorlesung.slides.html",
"Material/3.Vorlesung.ipynb",
"Material/Untitled.ipynb",
"Lectures/02 25.10.2024.md",
"To Do.md",
"README.md",
"Lectures/03 01.11.2024.md",
"Gruppen/MeWi 7 (DiKum).md",
"Gruppen/MeWi 6.md",
"Gruppen/MeWi 5.md",
"Gruppen/MeWi 4.md",
"Gruppen/MeWi 3.md",
"Gruppen/MeWi 2.md",
"Gruppen/MeWi 1.md",
"Gruppen/Engineering 1.md",
"Umfrage.md",
"Template/Gruppe.md",
"Template/Lecture.md",
"Gruppen",
"Material/README.md",
"Material/ToDo.md",
"Material/wise_24_25/lernmaterial/meme.png",
"Material/wise_24_25/lernmaterial/meme.webp",
"Student List.md",
"Timetable.md",
"Lectures/17 21.02.2025.md",
"Lectures/16 14.02.2025.md",
"Material/2.vorlesung.ipynb",
"Material/Untitled.ipynb",
"Material/env/etc/jupyter/labconfig/page_config.json",
"Material/env/etc/jupyter/labconfig",
"Material/env/lib/python3.12/site-packages/jupyter-1.1.1.dist-info/top_level.txt",
"Material/env/lib/python3.12/site-packages/jupyter-1.1.1.dist-info/WHEEL",
"Material/env/lib/python3.12/site-packages/jupyter-1.1.1.dist-info/REQUESTED",
"Material/env/lib/python3.12/site-packages/jupyter-1.1.1.dist-info/RECORD",
"Material/env/lib/python3.12/site-packages/jupyter-1.1.1.dist-info/METADATA",
"Material/env/lib/python3.12/site-packages/jupyter-1.1.1.dist-info/LICENSE",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/bootstrap/fonts/glyphicons-halflings-regular.svg",
"Material/env/lib/python3.12/site-packages/nbgrader/docs/source/user_guide/submitted/hacker/ps1/jupyter.png",
"Material/env/lib/python3.12/site-packages/nbgrader/docs/source/user_guide/submitted/bitdiddle/ps1/jupyter.png",
@ -241,25 +302,6 @@
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/underscore/README.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/jquery-color/README.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/jquery/README.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/datatables.net-bs/Readme.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/datatables.net/Readme.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/bootstrap/README.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/backbone/README.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/autosize/readme.md",
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/autosize/changelog.md",
"Material/env/lib/python3.12/site-packages/nbgrader/docs/source/user_guide/source/ps1_autotest/jupyter.png",
"Material/env/lib/python3.12/site-packages/nbgrader/docs/source/user_guide/source/ps1/jupyter.png",
"Material/env/lib/python3.12/site-packages/nbgrader/docs/source/changelog.md",
"Material/env/lib/python3.12/site-packages/jupyter_server/i18n/README.md",
"Material/env/lib/python3.12/site-packages/nbconvert/templates/skeleton/README.md",
"Material/env/lib/python3.12/site-packages/nbconvert/templates/README.md",
"Material/env/lib/python3.12/site-packages/httpx-0.27.2.dist-info/licenses/LICENSE.md",
"Material/env/lib/python3.12/site-packages/httpcore-1.0.6.dist-info/licenses/LICENSE.md",
"Material/env/lib/python3.12/site-packages/debugpy/_vendored/pydevd/pydevd_plugins/extensions/README.md",
"Material/env/lib/python3.12/site-packages/idna-3.10.dist-info/LICENSE.md",
"Material/env/lib/python3.12/site-packages/numpy/random/LICENSE.md",
"Material/env/lib/python3.12/site-packages/zmq/backend/cffi/README.md",
"Material/env/lib/python3.12/site-packages/pyzmq-26.2.0.dist-info/licenses/LICENSE.md",
"Material/env/lib/python3.12/site-packages/soupsieve-2.6.dist-info/licenses/LICENSE.md"
"Material/env/lib/python3.12/site-packages/nbgrader/server_extensions/formgrader/static/components/datatables.net-bs/Readme.md"
]
}

20
Gruppen/Engineering 1.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| -------------- | ------ | ------------ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| Janna Heiny | | | | [j.heiny@tu-braunschweig.de](mailto:j.heiny@tu-braunschweig.de) |
| Milena Krieger | | | | [m.krieger@tu-braunschweig.de](mailto:m.krieger@tu-braunschweig.de) |
| Xiaowei Wang | | | <span style="color:rgb(255, 0, 0)">39dc5bd7686c3280247aacee82c9818e</span> | [xiaowei.wang@tu-braunschweig.de](mailto:xiaowei.wang@tu-braunschweig.de) |
| | | | | |
| | | | | |
# Notizen
# Prüfung

20
Gruppen/MeWi 1.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| -------------- | ------ | ------------ | -------------------------------- | ----------------------------------------------------------------------------- |
| Sarina Apel | | | fa3a81b6a4251c0519004ede775a1b21 | [s.apel@tu-braunschweig.de](mailto:s.apel@tu-braunschweig.de) |
| Leonie Manthey | 28.5 | | 795801e6569e1edbcb4546f759c3b1fb | [leonie.manthey@tu-braunschweig.de](mailto:leonie.manthey@tu-braunschweig.de) |
| Natascha Roth | 29.5 | | 9ba71fe1d8252a47871d8b4b4723c833 | [n.rott@tu-braunschweig.de](mailto:n.rott@tu-braunschweig.de) |
| | | | | |
| | | | | |
# Notizen
# Prüfung

20
Gruppen/MeWi 2.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| ------------------- | ------ | ------------ | -------------------------------- | ----------------------------------------------------------------------- |
| Izabel Mike | 29.5 | | 8c710a24debf6159659d1e58dd975ce2 | [i.mike@tu-braunschweig.de](mailto:i.mike@tu-braunschweig.de) |
| Lara Troschke | 20.5 | | 7b441c67713f2a49811625905612f19b | [l.troschke@tu-braunschweig.de](mailto:l.troschke@tu-braunschweig.de) |
| Inga-Brit Turschner | 25.5 | | 72f0b5fd2cdf4dd808ca9a3add584c75 | [i.turschner@tu-braunschweig.de](mailto:i.turschner@tu-braunschweig.de) |
| | | | | |
| | | | | |
# Notizen
# Prüfung

20
Gruppen/MeWi 3.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| ----------------- | ------ | ------------ | --------------- | ----------------------------------------------------------------------------- |
| Fabian Rothberger | | | | [f.rothberger@tu-braunschweig.de](mailto:f.rothberger@tu-braunschweig.de) |
| Flemming Schur | | | | [flemming.schur@tu-braunschweig.de](mailto:flemming.schur@tu-braunschweig.de) |
| Josefine Sinkemat | | | | [j.sinkemat@tu-braunschweig.de](mailto:j.sinkemat@tu-braunschweig.de) |
| | | | | |
| | | | | |
# Notizen
# Prüfung

20
Gruppen/MeWi 4.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| ------------------ | ------ | ------------ | --------------------------------------------------------------------- | ----------------------------------------------------------------- |
| Nova Eib | 31 | | b313c08a73772a8237e0593ec5c3ee27 | [n.eib@tu-braunschweig.de](mailto:n.eib@tu-braunschweig.de) |
| Julia Renner | | | | [j.renner@tu-braunschweig.de](mailto:j.renner@tu-braunschweig.de) |
| Isabel Rudolf | | | <span style="color:rgb(255, 0, 0)">4306ac2b1bf2fe7189d53aad469</span> | [i.rudolf@tu-braunschweig.de](mailto:i.rudolf@tu-braunschweig.de) |
| Katharina Walz | 31 | | 6349002488dfe4343537174fb9381f95 | [k.walz@tu-braunschweig.de](mailto:k.walz@tu-braunschweig.de) |
| Unsichtbare Person | | | | |
# Notizen
# Prüfung

20
Gruppen/MeWi 5.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| -------------- | ------ | ------------ | -------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| Vikoria Litza | | | | [v.litza@tu-braunschweig.de](mailto:v.litza@tu-braunschweig.de) |
| Lea Noglik | | | <span style="color:rgb(255, 0, 0)">f24ccc1cefe390cd1036419b89f31d4f</span> | [l.noglik@tu-braunschweig.de](mailto:l.noglik@tu-braunschweig.de) |
| Donika Nuhiu | | | | [d.nuhiu@tu-braunschweig.de](mailto:d.nuhiu@tu-braunschweig.de) |
| Alea Unger | 30 | | f8c2ba8abf5b7d89a240902634a5c53a | [a.unger@tu-braunschweig.de](mailto:a.unger@tu-braunschweig.de) |
| Marie Wallbaum | | | <span style="color:rgb(255, 0, 0)">eec48a6d211105d6f87267fbd428ab69</span> | [m.wallbaum@tu-braunschweig.de](mailto:m.wallbaum@tu-braunschweig.de) |
# Notizen
# Prüfung

20
Gruppen/MeWi 6.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| --------------- | ------ | ------------ | -------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Nele Grundke | | | <span style="color:rgb(255, 0, 0)">f61621cbe911f21ddd781c21e4528b07</span> | [n.grundke@tu-braunschweig.de](mailto:n.grundke@tu-braunschweig.de) |
| Julia Limbach | | | | [j.limbach@tu-braunschweig.de](mailto:j.limbach@tu-braunschweig.de) |
| Melina Sablotny | | | <span style="color:rgb(255, 0, 0)">4111400b4ae2c863a1c4b73a21f87093</span> | [m.sablotny@tu-braunschweig.de](mailto:m.sablotny@tu-braunschweig.de) |
| Lucy Thiele | | | <span style="color:rgb(255, 0, 0)">4c0ddab5bed6ff025cee04f8d73301a3</span> | [lucy.thiele@tu-braunschweig.de](mailto:lucy.thiele@tu-braunschweig.de) |
| | | | | |
# Notizen
# Prüfung

20
Gruppen/MeWi 7 (DiKum).md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| ------------------- | ------ | ------------ | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| Abdalaziz Abunjaila | 30.5 | | 79b388885f89954decaefc9e19aa8871 | [a.abunjaila@tu-braunschweig.de](mailto:a.abunjaila@tu-braunschweig.de) |
| Marleen Adolphi | | | | [m.adolphi@tu-braunschweig.de](mailto:m.adolphi@tu-braunschweig.de) |
| Alea Schleier | | | | [a.schleier@tu-braunschweig.de](mailto:a.schleier@tu-braunschweig.de) |
| Marie Seeger | | | <span style="color:rgb(255, 0, 0)">f7017b11a2904a74302c9f4f217779fb</span> | [marie.seeger@tu-braunschweig.de](mailto:marie.seeger@tu-braunschweig.de) |
| Lilly-Lu Warnken | | | | [lilly-lu.warnken@tu-braunschweig.de](mailto:lilly-lu.warnken@tu-braunschweig.de) |
# Notizen
# Prüfung

View File

@ -8,7 +8,24 @@ tags:
- [ ] Ausgabe - Tutorial 2
- [ ] For loops - Container Loops
- [ ] Zähl loops
- [ ] Unterschied zu anderen Programmiersprachen
- [ ] range
- [ ] len
- [ ] _
- [ ] über liste loopen
- [ ] Dictionarys
- [ ] Error Handling
- [ ] .items
- [ ] .values
- [ ] .keys
- [ ] List Comprehension
- [ ] Vergleich mit Mengenlehre
- [ ] Dictionary Comprehension
- [ ] System Interactionen
- [ ] Import
- [ ] input
- [ ] open
- [ ] with Context
- [ ] Import
- [ ] std
- [ ] as
- [ ] from

9283
Material/2.vorlesung.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

916
Material/3.Vorlesung.ipynb Normal file
View File

@ -0,0 +1,916 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "87873422-9971-47b4-870b-82ea5cc663f2",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"# Lösungen Tutorial 1"
]
},
{
"cell_type": "markdown",
"id": "373d0d4a-c11a-4fe3-b3f2-46701690fd3a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe**: Geben Sie den Text `Hallo Python` aus. *1 Punkt*"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "bedcc819-ea7e-430e-ba1b-32543086d2dd",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hallo Python\n"
]
}
],
"source": [
"print(\"Hallo Python\")"
]
},
{
"cell_type": "markdown",
"id": "612aa876-5806-4ae8-96d7-578b96e1780a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *2 Punkte*: \n",
"\n",
"Definieren Sie zunächst die zwei Variablen `a` und `b` und initialisieren diese mit einem Integerwert ungleich `0`:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "fe38d9d9-9684-4d63-afe5-6eb68accf26d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"a = 1\n",
"b = -2"
]
},
{
"cell_type": "markdown",
"id": "bd7c915d-03b1-4c45-820b-6e2b12e81671",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *2 Punkte*:\n",
"\n",
"Definieren Sie zwei Variablen `s` und `t` und initialisieren diese mit einem Floatwert ungleich `0`:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "6065bb38-0482-42b9-bd57-b0660de9eb7a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"s = 1.5\n",
"t = -2.7"
]
},
{
"cell_type": "markdown",
"id": "87ddb6c9-5291-4693-a3e1-65ce8c0a3ea4",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *2 Punkte*:\n",
"\n",
"Addieren Sie die Werte der Variablen `a` und `b` und speichern Sie das Ergebnis in der Variable `c`:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "424e3dbe-ead5-4606-a1bc-6b0bb0739b40",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"-1"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c = a + b\n",
"c"
]
},
{
"cell_type": "markdown",
"id": "c57e8354-bde5-4139-bf93-ceca856568fc",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *5 Punkte*:\n",
"\n",
"Nutzen Sie die Variablen `a` & `b` und Speichern Sie die Ergebnisse für die Multiplikation, Division, Ganzzahldivision, Exponentiation und den Modulo-Operator in den unten angegebenen Variablen:\n",
"\n",
"\\begin{align}\n",
"m &= a\\cdot b\\\\\n",
"d &= \\frac{a}{b}\\\\\n",
"i &= \\lfloor\\frac{a}{b}\\rfloor\\\\\n",
"e &= a^b\\\\\n",
"r &= a\\; \\textrm{mod}\\; b\n",
"\\end{align}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c2078093-fd22-4fc2-9c79-11e716d047b1",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"m = a*b\n",
"d = a/b\n",
"i = a//b\n",
"e = a**b\n",
"r = a%b"
]
},
{
"cell_type": "markdown",
"id": "04ffad98-7f3c-40df-984a-021a2ad79800",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *2 Punkte*:\n",
"\n",
"Ein String-Objekt (Text) können sie mit Hilfe von `'Some Text'` oder `\"Some Text2\"` definieren. Definieren sie die Variable `text` mit einem beliebigen Text."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "68cb274d-dba5-49e8-a26e-cfb97499792f",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Hi Mom, I am on TV!'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"text = \"Hi Mom, I am on TV!\"\n",
"print(text)"
]
},
{
"cell_type": "markdown",
"id": "9dcb699b-091d-4d17-9e22-f958a34872b5",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie die Variablen `a` & `b` aus Aufgabe 1 im format `\"a = 12 und b = 12\"` (Die Werte sollen dann den Werten aus ihrer Definition entsprechen. 12 ist hier nur ein Beispiel) aus."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "745dda45-be87-4f55-a18a-fda0031148ba",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a = 1 und b = -2\n"
]
}
],
"source": [
"# 1. Möglichkeit Format Funktion\n",
"print(\"a = {} und b = {}\".format(a, b))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "579bc33a-9b26-428d-a4b8-cfb0a0960ff5",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a = 1 und b = -2\n"
]
}
],
"source": [
"# 2. Möglichkeit 'f'-String\n",
"print(f\"a = {a} und b = {b}\")"
]
},
{
"cell_type": "markdown",
"id": "df713414-9909-4130-b349-352cc8d951ed",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*: \n",
"\n",
"Definieren Sie die Variable `l` und weisen Sie dieser Variable eine Liste mit aufsteigenden Integerwerten von `0` bis `4` zu."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "0371e614-f9d1-4048-a710-531b4bea7708",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"l = [0, 1, 2, 3, 4]"
]
},
{
"cell_type": "markdown",
"id": "41220c65-8c6b-486d-9da7-cecdce957ef3",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Hängen Sie der Liste `l` noch den Wert `42` an.\n",
"\n",
"Hinweis: Nutzen Sie dafür die Methode [.append](https://www.w3schools.com/python/ref_list_append.asp)."
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "5f14b238-738e-4f37-9f80-b09b373bc387",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"l.append(42)"
]
},
{
"cell_type": "markdown",
"id": "007e4252-a8c5-464e-8a71-bda2718b6c5e",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie das dritte Element der Liste `l` aus.\n",
"\n",
"Hinweis: Achten Sie darauf das der erste Index immer `0` ist. "
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "b5f1c844-9017-459a-aebf-fabd639310d9",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l[2]"
]
},
{
"cell_type": "markdown",
"id": "478993a1-d922-4f3c-bde7-316e01688709",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie das vorletzte Element der Liste `l` aus.\n",
"\n",
"Hinweis: Achten Sie darauf das der letzte Index mit `-1` ausgegeben wird"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "f38d72ab-062e-4204-86dc-32864ef9cf5d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l[-2]"
]
},
{
"cell_type": "markdown",
"id": "d19f6acb-8046-4a7b-b0b9-78fe655246dc",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Initialisieren Sie die Dictionary Variable `my_dict` mit folgendem Mapping:\n",
"\n",
"| Key | Value |\n",
"|:----|:------|\n",
"| `\"apple\"` | `\"Apfel\"` |\n",
"| `\"banana\"` | `\"Banane\"` |\n",
"| `\"cherry\"` | `\"Kirsche\"` |"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "4faaf2df-a250-41b2-aa26-d3e6a7327f01",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"my_dict = {\"apple\": \"Apfel\", \"banana\": \"Banane\", \"cherry\": \"Kirsche\"}"
]
},
{
"cell_type": "markdown",
"id": "74939a92-ed87-44d8-894a-b6d5d5a05773",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Fügen Sie nun das Key-Value Paar `\"pear\": \"Birne\"` zu `my_dict` hinzu."
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "0cfbda9f-e6fe-4145-b4a4-05e6c9cdd576",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [],
"source": [
"my_dict[\"pear\"] = \"Birne\""
]
},
{
"cell_type": "markdown",
"id": "e5e4cd89-f01e-44df-91b7-7b255f5c4b67",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie die nur die Werte des Dictionaries `my_dict` aus."
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "d0166c7e-6a45-461b-9369-53de7ccc7e8b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_values(['Apfel', 'Banane', 'Kirsche', 'Birne'])\n"
]
}
],
"source": [
"print(my_dict.values())"
]
},
{
"cell_type": "markdown",
"id": "7691cbcc-8af1-41be-9b01-e499d9981b48",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie die Elemente des Dictionaries `my_dict` mit der Funktion `.items()` aus. "
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "a4f9f233-6f60-4d5d-a4ea-2f8be73be3d5",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_items([('apple', 'Apfel'), ('banana', 'Banane'), ('cherry', 'Kirsche'), ('pear', 'Birne')])\n"
]
}
],
"source": [
"print(my_dict.items())"
]
},
{
"cell_type": "markdown",
"id": "44035bd1-3721-4510-aadc-b464f45e66a8",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"## Recap"
]
},
{
"cell_type": "markdown",
"id": "1aa5ee93-7aba-4ae2-9a7f-77b133d0762b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"```python\n",
"def some_function_name(param1, param2):\n",
" a = do_something1(param1)\n",
" b = do_something2(a, param2)\n",
" do_something3(b)\n",
" return b\n",
"```\n",
"\n",
"\"gebe zurück\" = `return`\n",
"\"gebe aus\" = `print`"
]
},
{
"cell_type": "markdown",
"id": "6095807e-03f2-42d0-89b8-54356206bd79",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Schreibe eine Funktion `successor` die auf jede Eingabe `+1` rechnet."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "58784328-5d18-45e7-8283-226391292461",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"43"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def successor(n):\n",
" return n+1\n",
"\n",
"successor(42)"
]
},
{
"cell_type": "markdown",
"id": "c792960f-f678-43f6-ba52-9e6904ec9077",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Schreibe eine Funktion `add` mit den Eingabeparametern `a` & `b`, welche die Werte von `a` & `b` miteinander addiert."
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "b49b07e2-b2b6-4dc6-8ad7-32e4722616e9",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"7"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def add(a,b):\n",
" return a+b\n",
"\n",
"add(2,5)"
]
},
{
"cell_type": "markdown",
"id": "a94076aa-259b-44ee-9ee4-e239089d04fe",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Schreibe eine Funktion `is_odd` mit einem Eingabeparameter `n` die prüft ob die eingegebene Zahl ungerade ist.\n",
"\n",
"Wenn die Zahl gerade ist gebe den Text `\"Gerade Zahl\"` und bei ungerade `\"Ungerade Zahl\"` zurück."
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "e5f9cd1d-3bd7-49ff-9ea7-53899db1d911",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gerade Zahl\n",
"Ungerade Zahl\n"
]
}
],
"source": [
"def is_odd(n):\n",
" if n % 2 == 0:\n",
" return \"Gerade Zahl\"\n",
" else:\n",
" return \"Ungerade Zahl\"\n",
"\n",
"print(is_odd(2))\n",
"print(is_odd(3))"
]
},
{
"cell_type": "markdown",
"id": "b65cb60c-34ad-40eb-b0b6-934abaab3bb6",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"**Aufgabe** 7 Punkte: Schreibe eine Funktion `fubar` mit Eingabeparameter `n`.\n",
"Die Funktion soll wie folgt definiert sein:\n",
"\n",
"- Der Eingabeparameter `n` ist ein Integer, Floats geben `False` zurück\n",
"- Negative zahlen & 0 beenden die Funktion und geben `False` zurück\n",
"- Die Funktion zählt bis einschließlich dem Eingabeparameter\n",
" bsp.: $n=9 \\rightarrow 1, 2, 3, \\dots, 9$\n",
"- Bei jedem Schleifendurchlauf soll die Zahl bei der sich die Schleife gerade befindet mittels `print` ausgegeben werden werden.\n",
"- Ist der zurzeitige Schleifendurchlauf durch `3` teilbar, gebe mittels `print` denn String `Foo` aus.\n",
"- Ist der zurzeitige Schleifendurchlauf durch `5` teilbar, gebe mittels `print` denn String `Bar` aus.\n",
"- Ist der zurzeitge Schleifendurrchlauf durch `3 & 5` teilbar, gebe mittels `print` den String `FooBar` aus.\n",
"\n",
"**Tipp**: Implementiere nicht alles aufeinmal sollte Schritt für Schritt und teste deine Lösung nach jedem Schritt."
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "bec1be94-561e-4379-86a0-d302ef150920",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"outputs": [],
"source": [
"def fubar(n: int):\n",
" if isinstance(n, float) or n < 1:\n",
" return False\n",
"\n",
" count = 1\n",
" while count <= n:\n",
" msg = count\n",
" if count % 3 == 0:\n",
" msg = \"Foo\"\n",
" if count % 5 == 0:\n",
" msg = \"Bar\"\n",
" if count % 15 == 0:\n",
" msg = \"FooBar\"\n",
" \n",
" count += 1\n",
" print(msg, end=', ')"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "ad665bb0-9976-43e9-b8ab-bb52c4a0f1d4",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Negative Zahl False\n",
"Null False\n",
"Float False\n",
"Testen über 15\n",
"1, 2, Foo, 4, Bar, Foo, 7, 8, Foo, Bar, 11, Foo, 13, 14, FooBar, 16, "
]
}
],
"source": [
"# Testen\n",
"print(\"Negative Zahl\", fubar(-1))\n",
"print(\"Null\", fubar(0))\n",
"print(\"Float\", fubar(0.1))\n",
"print(\"Testen über 15\")\n",
"fubar(16)"
]
}
],
"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.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because one or more lines are too long

View File

@ -75,7 +75,7 @@
"In Python sehe selbiger Code wie folgt aus:\n",
"\n",
"```python\n",
"for i in range(0,arr.length()):\n",
"for i in range(0,len(arr)):\n",
" # do something\n",
"```\n",
"\n",
@ -1722,7 +1722,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.12.7"
}
},
"nbformat": 4,

20
Template/Gruppe.md Normal file
View File

@ -0,0 +1,20 @@
---
parent: "[[Gruppe]]"
tags:
- Gruppe
- Prüfung
- Punkte
---
# Mitglieder
| Name | Punkte | Durchschnitt | Jupyter Kennung | Mail |
| ---- | ------ | ------------ | --------------- | ---- |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
# Notizen
# Prüfung

View File

@ -1 +1,8 @@
- [ ] Obsidian publish over https://github.com/oleeskild/Obsidian-digital-garden
5ce6c08f9b055ca085232da514623ca4 - Aurela Brahimi
8be9a4cc0b240a18171892b873dc2cb8 - Milena Krieger 30

BIN
submissions.xlsx Normal file

Binary file not shown.