Changed Structure added v7

This commit is contained in:
DerGrumpf 2024-12-06 13:07:27 +01:00
parent f5e98f3ba3
commit 1b700db9ca
36 changed files with 7522 additions and 14344 deletions

View File

@ -11,14 +11,12 @@
"id": "85d70f5e9df52245",
"type": "leaf",
"state": {
"type": "markdown",
"type": "pdf",
"state": {
"file": "Timetable.md",
"mode": "source",
"source": false
"file": "KC_Deutsch_HS_Anhrung.pdf"
},
"icon": "lucide-file",
"title": "Timetable"
"icon": "lucide-file-text",
"title": "KC_Deutsch_HS_Anhrung"
}
},
{
@ -227,26 +225,33 @@
},
"active": "85d70f5e9df52245",
"lastOpenFiles": [
"Material/wise_24_25/Folien/6.Lösungen_Monte_Carlo.html",
"Material/wise_24_25/6.Lösungen_Monte_Carlo.ipynb",
"Material/wise_24_25/Untitled.ipynb",
"Material/wise_24_25/lernmaterial/6.Monte_Carlo.ipynb",
"README.md",
"Timetable.md",
"KC_Deutsch_HS_Anhrung.pdf",
"Material/wise_24_25/lernmaterial/people_in_germany.csv",
"Material/wise_24_25/lernmaterial/Bees.csv",
"Material/env/lib/python3.12/site-packages/seaborn-0.13.2.dist-info/WHEEL",
"Material/env/lib/python3.12/site-packages/seaborn-0.13.2.dist-info/REQUESTED",
"Material/env/lib/python3.12/site-packages/seaborn-0.13.2.dist-info/RECORD",
"Material/env/lib/python3.12/site-packages/seaborn-0.13.2.dist-info/METADATA",
"Material/env/lib/python3.12/site-packages/seaborn-0.13.2.dist-info/LICENSE.md",
"Lectures/17 18.02.2025.md",
"Lectures/16 17.02.2025.md",
"Timetable.md",
"Lectures/13 31.01.2025.md",
"Lectures/12 24.01.2025.md",
"Lectures/11 17.01.2025.md",
"Lectures/10 10.01.2025.md",
"Lectures/09 13.12.2024.md",
"Lectures/10 03.01.2025.md",
"Material/SciPy_Lösungen.slides.html",
"Material/wise_24_25/lernmaterial/SciPy_Lösungen.ipynb",
"Material/wise_24_25/lernmaterial/Untitled.ipynb",
"Material/wise_24_25/lernmaterial/6.Monte_Carlo.ipynb",
"Lectures/07 29.11.2024.md",
"Lectures/06 22.11.2024.md",
"Lectures/05 15.11.2024.md",
"Gruppen/MeWi 1.md",
"Lectures/27.11.2024.md",
"Material/wise_24_25/lernmaterial/5.SciPy.ipynb",
"Material/Untitled.ipynb",
"Lectures/15 14.02.2025.md",
"To Do.md",
"Gruppen/Engineering 1.md",
@ -256,10 +261,6 @@
"Gruppen/MeWi 4.md",
"Gruppen/MeWi 3.md",
"Gruppen/MeWi 2.md",
"Material/3.Extended_Applications_Lösungen.html",
"Material/3.Lösungen_Extended_Applications.html",
"Material/wise_24_25/lernmaterial/2.Tutorial_2.ipynb",
"Material/wise_24_25/lernmaterial/1.Tutorial_1.ipynb",
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/sample_data/logo2.png",
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/sample_data/grace_hopper.jpg",
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/sample_data/Minduka_Present_Blue_Pack.png",
@ -269,9 +270,6 @@
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/images/zoom_to_rect-symbolic.svg",
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/images/subplots_large.png",
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/images/subplots.svg",
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/images/subplots.png",
"Lectures/04 08.11.2024.md",
"Lectures/03 01.11.2024.md",
"Lectures/02 25.10.2024.md"
"Material/env/lib/python3.12/site-packages/matplotlib/mpl-data/images/subplots.png"
]
}

BIN
KC_Deutsch_HS_Anhrung.pdf Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,916 +0,0 @@
{
"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
}

View File

@ -1,532 +0,0 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "1486c477-e52f-492a-a699-4f6668f43826",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"<div style=\"display:flex;\">\n",
" <div style=\"text-align: left\">\n",
" <h1>Lösungen Tutorial 2</h1>\n",
" </div>\n",
" <img style=\"float: right; margin: 0px 15px 15px 0px\" src=\"https://preview.redd.it/44aw5j979ve61.png?auto=webp&s=a0285d3a6e42e88b15bd738bc483412bb3efb019\" width=\"300\" />\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "89c3ed2f-6f9b-4d5c-adeb-482b4fd83b2b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe \n",
"\n",
"*3 Punkte*\n",
"\n",
"Schreibe eine Funktion `sum_up` mit Eingabeparameter `n`, welcher die Zahlen von `1...n` aufsummiert.\n",
"\n",
"Nutze dafür einen `for-loop`.\n",
"\n",
"**Beispiel**:\n",
"\n",
"$$n = 5$$ \n",
"$$sum\\_up(5) \\rightarrow 1 \\rightarrow 1 + 2 = 3 \\rightarrow 3 + 3 = 6 \\rightarrow 6 + 4 = 10 \\rightarrow 10 + 5 = 15$$\n",
"\n",
"Hinweis: die Funktion `range()` zählt standardmässig von `0...n-1`. Schauen Sie sich gerne dazu die offizielle Dokumentation an [PEP 204](https://peps.python.org/pep-0204/#list-ranges)."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d6de90ca-1db9-4c59-a5a4-42016370cb35",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"15"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def sum_up(n: int) -> int:\n",
" count = 0\n",
" for i in range(1,n+1):\n",
" count += i\n",
" return count\n",
"\n",
"sum_up(5)"
]
},
{
"cell_type": "markdown",
"id": "7a9de268-09e4-45e5-8aa9-db5ae79e9540",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"source": [
"Es gibt immer einen besseren weg.\n",
"\n",
"Nach Gauß:\n",
"\n",
"$$\\sum_{k=1}^n k = 1 + 2 + 3 + \\dots + n = \\frac{n(n+1)}{2}$$"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "fd8eea02-c356-4906-8db8-ae4cdaf4f97c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"15"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# nach Gauß\n",
"def sum_up(n: int) -> int:\n",
" return int(n*(n+1)/2)\n",
"\n",
"sum_up(5)"
]
},
{
"cell_type": "markdown",
"id": "ea73e1ec-7b2a-4293-b269-03b8054aaa54",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*2 Punkte*\n",
"\n",
"Ihnen ist das Dictionary `dict2` gegeben. Ändern Sie jeden Wert in dem Dictionary nach der Formel $f(x) = x^3-1$ mittels `for-loop`.\n",
"\n",
"Tipp: Lassen Sie sich nicht von den Schlüsseln verwirren."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "2a3e9cac-49ee-49f0-88da-a75e9611f1d8",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"{'a': 56, 5: 12, 'python': 9, 3.14: 1.141414}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Vorgegeben\n",
"dict2 = {\"a\": 56, 5: 12, \"python\": 9, 3.14: 1.141414}\n",
"dict2"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "26aa9f7b-b5e8-4f8f-a0d0-b796b253ad71",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"{'a': 175615, 5: 1727, 'python': 728, 3.14: 0.48706374396146557}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Kurze Lösung mittels Dictionary Comprehension\n",
"dict2 = {key: value**3-1 for key, value in dict2.items()}\n",
"dict2"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "4f625aaf-a04b-4c08-b18b-915b61c0145c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"{'a': 175615, 5: 1727, 'python': 728, 3.14: 0.48706374396146557}"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Lange Übersichtliche Lösung\n",
"for key, value in dict2.items():\n",
" dict2[key] = dict2[key]**3 - 1\n",
"dict2"
]
},
{
"cell_type": "markdown",
"id": "c4a7b4a9-7cbd-4127-8832-fdd7c3541409",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Zusatzaufgabe \n",
"\n",
"*Keine Punkte*\n",
"\n",
"Erstellen Sie eine List mittels List Comprehension, welche die Zahlen `1...6` auf deren kubische Zahl `1...216` also der Funktion $f(x) = x^3$ abbildet."
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "f8e84221-f7da-474a-aa14-bcf7d1d3a201",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[1, 8, 27, 64, 125, 216]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cubics = [n**3 for n in range(1,7)]\n",
"cubics"
]
},
{
"cell_type": "markdown",
"id": "3cdbb5b7-f828-48eb-ba49-09d5ae68c2d7",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*2 Punkte*\n",
"\n",
"Erstellen und Öffnen sie eine Datei `testfile.txt` mit der `open` Funktion, nutzen Sie dafür das `with`-Statement.\n",
"\n",
"Schreiben Sie in diese Datei 100 mal den String `\"Python\\n\"`."
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "90875b44-8209-498a-ad38-063772588711",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [],
"source": [
"with open('testfile.txt', 'w') as f:\n",
" for _ in range(100):\n",
" f.write(\"Python\\n\")"
]
},
{
"cell_type": "markdown",
"id": "c69ac8e9-34ef-413a-a39f-7db6a830cde3",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*2 Punkte*\n",
"\n",
"Öffnen Sie die zuvor erstellte Datei `testfile.txt` im Lesemodus und weißen Sie den Inhalt der `.readlines()` Funktion der Variabeln `lines` zu. "
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "a8395ec5-59dc-43e3-a59d-9dea7cf1f21d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Anzahl der gelesenen Zeilen: 100\n"
]
}
],
"source": [
"lines = None # vorgegeben\n",
"with open('testfile.txt', 'r') as f:\n",
" lines = f.readlines()\n",
"\n",
"print(\"Anzahl der gelesenen Zeilen:\", len(lines))"
]
},
{
"cell_type": "markdown",
"id": "00561f0d-9d9f-45bd-bf1f-824f04edf795",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*3 Punkte*\n",
"\n",
"Importiere Python Built-In Library `random` und rufe zuerst aus dem Modul die Funktion `seed` auf mit dem Eingabewert `42`, und weiße danach der Variable `rand` den Wert des Funktionsaufrufes von `randint(1,100)` zu. "
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "63c44277-581a-426c-8e2d-ed911688ca91",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"82"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rand = None # vorgegeben\n",
"import random\n",
"random.seed(42)\n",
"rand = random.randint(1,100)\n",
"rand"
]
},
{
"cell_type": "markdown",
"id": "78ec5791-46b7-4693-b276-7f5e73a18eb7",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*1 Punkt*\n",
"\n",
"Importieren Sie die Built-In Library `datetime` als `dt`."
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "e3f4fe99-5980-4c2a-be4e-ae777f4bbb3d",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2024-11-08 11:58:43.750641\n"
]
}
],
"source": [
"import datetime as dt\n",
"print(dt.datetime.now())"
]
},
{
"cell_type": "markdown",
"id": "d1bf6ca3-4f96-456e-a8e9-34d9fd081c5b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*2 Punkte*\n",
"\n",
"Importieren Sie die Funktion `sqrt` aus dem Built-In Modul `math`.\n",
"Berechnen Sie $\\sqrt4$. Speichern Sie das Ergebnis in der variablen `s4`."
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "eed3fc0f-67c1-43d5-ac2f-f6b7646aecdd",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"2.0"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from math import sqrt\n",
"s4 = sqrt(4)\n",
"s4"
]
}
],
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,122 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "d74e7711-ed1a-4749-8827-2e6fa5798d68",
"metadata": {},
"outputs": [],
"source": [
"def lcg (a,c,m, startwert):\n",
"\n",
" if a<=0 or c<0 or m<=0 or startwert <0:\n",
" return None #prüfung der werte \n",
" \n",
" x = startwert \n",
" while 1:\n",
" x=(a*x+c)%m\n",
" yield x "
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "2993ac89-2be8-4c61-a6e2-43a1008f2d36",
"metadata": {},
"outputs": [],
"source": [
"def lcg_test(seed: int, scalar: int, modulus: int, offset: int) -> int:\n",
" assert modulus > 0, \"Modulus must be greater than 0\"\n",
" assert 0 <= scalar and scalar < modulus, \"Scalar must be in range 0 <= a < m\"\n",
"\n",
" while seed > 1:\n",
" seed = (scalar*seed+offset) % modulus\n",
" assert seed >= 0\n",
" yield seed"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "02a21a6d-0892-44f0-b0fd-6e5f8fe83962",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Lcg using Cocktailshaker Numbers: 3089810780120156248\n",
"Correct should be: 3089810780120156248\n",
"\n",
"Lcg using Cocktailshaker Numbers: 8356396685252565260\n",
"Correct should be: 8356396685252565260\n",
"\n",
"Lcg using Cocktailshaker Numbers: 1921117399837525548\n",
"Correct should be: 1921117399837525548\n",
"\n",
"Lcg using Cocktailshaker Numbers: 14806858147081821235\n",
"Correct should be: 14806858147081821235\n",
"\n",
"Lcg using Cocktailshaker Numbers: 2557599628047639428\n",
"Correct should be: 2557599628047639428\n",
"\n",
"Lcg using Cocktailshaker Numbers: 16453652254840064460\n",
"Correct should be: 16453652254840064460\n",
"\n",
"Lcg using Cocktailshaker Numbers: 15995401842808378843\n",
"Correct should be: 15995401842808378843\n",
"\n",
"Lcg using Cocktailshaker Numbers: 681272290641816305\n",
"Correct should be: 681272290641816305\n",
"\n",
"Lcg using Cocktailshaker Numbers: 10955466795170118648\n",
"Correct should be: 10955466795170118648\n",
"\n",
"Lcg using Cocktailshaker Numbers: 13714992071537968180\n",
"Correct should be: 13714992071537968180\n",
"\n"
]
}
],
"source": [
"s = lcg(3203021881815356449, 11742185885288659963, 2**64-1, 3935559000370003845)\n",
"t = lcg_test(3935559000370003845, 3203021881815356449, 2**64-1, 11742185885288659963)\n",
"\n",
"for _ in range(10):\n",
" stud = next(s)\n",
" instructor = next(t)\n",
" print(\"Lcg using Cocktailshaker Numbers:\", stud)\n",
" print(\"Correct should be:\", instructor, end='\\n\\n')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "40aeb297-aeb5-4fca-8ae4-cb84c7f13957",
"metadata": {},
"outputs": [],
"source": []
}
],
"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 it is too large Load Diff

View File

@ -1,637 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "80fd796e-f42e-4940-89ae-e7359be4d10a",
"metadata": {},
"source": [
"# 4 Vorlesung"
]
},
{
"cell_type": "markdown",
"id": "cb2fcdfe-257a-4736-b9c2-5fa17d63fd1b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Generatoren\n",
"```python\n",
"def <funktion-name>(<parameterliste>):\n",
" # do something\n",
" yield <ergebnis>\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "0ea7c66c-439c-4a3b-a154-3449c2a799a1",
"metadata": {},
"source": [
"### Endliche Generatoren"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "d5465edd-a13d-4fa0-a805-30c35a384d54",
"metadata": {},
"outputs": [],
"source": [
"# Matrikelnummer generator\n",
"import random \n",
"def mat_nr_gen(anzahl: int) -> float:\n",
" for _ in range(anzahl):\n",
" yield random.randint(500_000, 700_000) # Generator weil yield"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "48109f19-47d2-45a1-bd03-9eccb4d25372",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<generator object mat_nr_gen at 0x10838f060>"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sem_3 = mat_nr_gen(5) # generator erstellen\n",
"sem_3"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "413bbbf6-87c8-41ff-8680-a70e8456d865",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"559540"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"next(sem_3) # Nächsten Wert des Generators"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "14a1220d-ae0c-428b-bd51-564e66e55854",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"606586"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"next(sem_3) # ..."
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "af75146c-e727-41e8-b496-695b93a68a56",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"503048\n",
"648312\n",
"629536\n",
"556597\n",
"512158\n"
]
}
],
"source": [
"for _ in range(5):\n",
" print(next(sem_3)) # 5 mal den generator aufrufen"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "4691aa5c-0e3d-4dff-93c1-835a805e20e9",
"metadata": {},
"outputs": [
{
"ename": "StopIteration",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[19], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43msem_3\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mStopIteration\u001b[0m: "
]
}
],
"source": [
"next(sem_3) # Generator hat keine Werte mehr -> Fehler"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "6790f776-4201-403f-b95d-d789a4fe3a6f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"591325\n",
"582340\n",
"622867\n",
"653166\n",
"531169\n",
"538806\n",
"571659\n"
]
}
],
"source": [
"for mat_nr in mat_nr_gen(7): # For loop übernimmt die komplette Arbeit\n",
" print(mat_nr)"
]
},
{
"cell_type": "markdown",
"id": "4cfbb732-c412-4ded-8f33-75a9917b0df1",
"metadata": {},
"source": [
"### Unendliche Generatoren"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "b2b3c678-a775-4213-9a73-4d3aa48eff5e",
"metadata": {},
"outputs": [],
"source": [
"# Seriennummer generator\n",
"def serial_nr_gen() -> int:\n",
" while True: # \"Führe unendlich of aus\"\n",
" yield random.randint(1000, 2000) # Generator weil yield"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "e6ba3c92-465c-487d-a936-a155ad713784",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1940\n",
"1748\n",
"1342\n",
"1463\n",
"1100\n",
"1748\n",
"1158\n",
"1577\n",
"1321\n",
"1949\n"
]
}
],
"source": [
"ser_gen = serial_nr_gen() # Generator erstellen\n",
"for _ in range(10):\n",
" print(next(ser_gen)) # 10 mal den generator abfragen"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "c015d2c3-238b-454a-b75e-f81a19f89a79",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1281"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"next(ser_gen) # Diesmal kein Fehler da Generator kein Ende hat"
]
},
{
"cell_type": "markdown",
"id": "cd8ed607-c0e0-481c-aaa7-cf07e8c97051",
"metadata": {},
"source": [
"## Type Hints"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "9f564549-70d7-4538-a3fd-7158514fa0d4",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{2.0: 2.0, 'HI': 'HI', 9: 9, True: True}\n",
"0.0 <class 'float'>\n"
]
}
],
"source": [
"# Beispielfunktion\n",
"\n",
"# Type hints zeigen dem Programmierer welche Datentypen erwartet werden\n",
"def useless(p1: int, p2: float, p3: bool, p4: str) -> dict: \n",
" return {p1: p1, p2: p2, p3: p3, p4: p4}\n",
"\n",
"print(useless(2.0, \"HI\", 9, True)) # Aufruf mit \"Falschen\" Datentypen\n",
"\n",
"# Beispielvariablen:\n",
"zahl: int = 0.0 # Zahl ist ein Float\n",
"print(zahl, type(zahl))"
]
},
{
"cell_type": "markdown",
"id": "2572fb15-de4f-4be7-809b-955d26895d84",
"metadata": {},
"source": [
"## Dataclasses\n",
"\n",
"Auto Dataclass\n",
"\n",
"|Attribut|Wert|\n",
"|-|-|\n",
"|Marke|VW|\n",
"|Fahrzeugtyp|Limousine|\n",
"|Seriennummer|<Zufällig generiert>|"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "feb80166-b58a-46bf-94b0-f26142d6131f",
"metadata": {},
"outputs": [],
"source": [
"from dataclasses import dataclass"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "b9c6ba77-1d59-4058-b18c-601989d9b8db",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function dataclasses.dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False)>"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataclass # Decorator"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "81e41f92-8ce6-40de-9319-629cb69c73e9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Auto(marke='VW', model='Limousine', serial_nr=1146)"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ser_gen = serial_nr_gen()\n",
"\n",
"# Diese Syntax einfach merken\n",
"@dataclass\n",
"class Auto:\n",
" marke: str # 1 Attribut\n",
" model: str # 2 Attribut\n",
" serial_nr: int = next(ser_gen) # 3 Attribut mit Standardwert\n",
"\n",
"Auto(\"VW\", \"Limousine\") # Erstellt eine Auto Dataclass "
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "f2e0e50e-f1f9-4ead-8530-0aeb40989581",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Auto(marke='Porsche', model='SUV', serial_nr=1146)"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Auto(model=\"SUV\", marke=\"Porsche\") # Attribute können explizit definiert werden"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "e5cb5618-50a9-4e38-a0b4-7e3e5e4c2295",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Auto(marke='Porsche', model='SUV', serial_nr=5678)"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Auto(model=\"SUV\", serial_nr=5678, marke=\"Porsche\") # Standardwerte lassen sich überschreiben "
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "655cbee0-88c0-4f60-97c5-4ef475d59f0b",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "Auto.__init__() got an unexpected keyword argument 'reifenzahl'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[37], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mAuto\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mSUV\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mserial_nr\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m5678\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmarke\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mPorsche\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mreifenzahl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m5\u001b[39;49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mTypeError\u001b[0m: Auto.__init__() got an unexpected keyword argument 'reifenzahl'"
]
}
],
"source": [
"Auto(model=\"SUV\", serial_nr=5678, marke=\"Porsche\", reifenzahl=5) # Nicht bekanntes Attribut wirft Fehler"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "22c0625c-4e7d-46aa-a711-5cc2bb759427",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'marke': 'Porsche', 'model': 'SUV', 'serial_nr': 12766}"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Beispiel als Dict\n",
"vw = {\n",
" \"marke\": \"Porsche\",\n",
" \"model\": \"SUV\",\n",
" \"serial_nr\": 12766\n",
"}\n",
"\n",
"vw"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "77668ca0-719d-48b8-954f-b2f7becdb318",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'marke': 'Porsche', 'model': 'SUV', 'serial_nr': 12766, 'reifenzahl': 7}"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Dict wirft keinen Fehler\n",
"vw[\"reifenzahl\"] = 7\n",
"vw"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "deb76203-f99c-45d1-b1f6-8395dc22ccab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Porsche'"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vw[\"marke\"] # Zugriff auf Wert im dict"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "b3397bbe-0925-4189-b079-bef46a3dff95",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Auto(marke='Porsche', model='SUV', serial_nr=5678)"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"porsche = Auto(model=\"SUV\", serial_nr=5678, marke=\"Porsche\")\n",
"porsche"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "4a244554-957a-423d-8561-765aad99475a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'SUV'"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"porsche.model # Zugriff auf Attribut in der Dataclass"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "3c02985e-e7b7-4dd6-aad5-02a3bd3e5312",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5678"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"porsche.serial_nr # same"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "57ccfffc-e89b-4c51-bc6d-7bf2ca16720f",
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'mark'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[44], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mvw\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmark\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\n",
"\u001b[0;31mKeyError\u001b[0m: 'mark'"
]
}
],
"source": [
"vw[\"mark\"] # KeyError wenn schlüssel nicht vorhanden im dict"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "8e508117-c1b3-4bf1-b9ae-a73b7bafd801",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Auto(marke=True, model=2.14, serial_nr=1146)"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Type Hints sind Type Hints und hindern nicht daran \"Falsche\" Datentypen an die Dataclasss zu vergeben \n",
"Auto(model=2.14, marke=True) "
]
}
],
"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.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1 +0,0 @@
Ich will nachhause

View File

@ -1,4 +0,0 @@
Super Secret Message
Hallo Welt
Geiler Kurs
Freitag 15h yeah

View File

@ -1,100 +0,0 @@
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python
Python

View File

@ -2684,7 +2684,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.12.7"
}
},
"nbformat": 4,

View File

@ -1714,7 +1714,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.12.7"
}
},
"nbformat": 4,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,334 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "c3c41172-0fa4-4542-af74-5912b25dce09",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"# Lösungen Extended Applications"
]
},
{
"cell_type": "markdown",
"id": "0200f54c-1416-4e4b-bcb9-fbe781bff590",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*3 Punkte*\n",
"\n",
"Schreibe einen Generator `square_count` mit einem Eingabeparameter `n`, welcher die Quadratzahlen von $1\\dots n^2$ ausgibt.\n",
"\n",
"Die Aufgabe gibt 0 Punkte, wenn die Funktion `square_count` kein Generator ist!\n",
"\n",
"Hinweis: Bei Eingabe von `5` soll die Ausgabe `1 4 9 16` sein."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "b27328c4-e085-4783-8ea8-c45c62b63d9f",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Square Numbers from 0 to 1: 1\n",
"Square Numbers from 0 to 2: 1 4\n",
"Square Numbers from 0 to 3: 1 4 9\n",
"Square Numbers from 0 to 4: 1 4 9 16\n",
"Square Numbers from 0 to 5: 1 4 9 16 25\n"
]
}
],
"source": [
"def square_count(n: int) -> int: \n",
" for i in range(1, n):\n",
" yield i*i\n",
"\n",
"for n in range(2, 7):\n",
" print(f\"Square Numbers from 0 to {n-1}:\", *square_count(n))"
]
},
{
"cell_type": "markdown",
"id": "72f74416-f665-475f-a411-aa2ad5a9c257",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*3 Punkte*\n",
"\n",
"Schreibe einen Generator `naturals`, welcher mit jedem Aufruf die nächste natürliche Zahl ausgibt. (Angefangen mit 1)\n",
"\n",
"- Es sind keine Eingabeparameter notwendig.\n",
"- Ist die Funktion kein generator, wird diese Aufgabe mit 0 Punkten bewertet\n",
"\n",
"*Hinweis*: Orientiere dich an dem Beispiel `faktoriel_gen`"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "e5023e1a-1ab0-42ec-87f2-87c2eee46274",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [],
"source": [
"import types"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "8769a98d-5ec0-407a-9ba0-538daff61597",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1, 2, 3, 4, 5, 6, 7, 8, 9, "
]
}
],
"source": [
"def naturals() -> int:\n",
" curr = 1\n",
" while 1:\n",
" yield curr\n",
" curr += 1\n",
" \n",
"gen: types.GeneratorType = naturals()\n",
"for i in range(1, 10):\n",
" number: int = next(gen)\n",
" print(number, end=', ')"
]
},
{
"cell_type": "markdown",
"id": "7514798b-d716-4161-a0b7-a644ac8bc67a",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*6 Punkte*\n",
"\n",
"Schreiben Sie eine Dataclass `Student`\n",
"\n",
"- Die dataclass soll die Werte `vorname`, `nachname`, `semester` und `mat_nr` speichern, vergebe hierzu selber den !!geeigneten!! Datentypen. Mache dir dazu Gedanken ob es Sinnvoll beispielweise die Semesteranzahl als Float zu speichern.\n",
"\n",
"- importiere aus dem dataclasses modul die Funktion `asdict`, erstelle ein Objekt mit den Werten aus dem Beispielstundent, weiße den rückgabewert aus `asdict` aufgerufen mit dem Beispielstudenten der Variablen `stud` zu.\n",
"\n",
"- Die Aufgabe wird mit 0 Punkten bewertet, wenn `Student` keine dataclass ist!\n",
"\n",
"- Hat einer der Attribute keinen geeigneten Datentypen, führt dies nicht zu Punktabzug bei zwei oder mehr schon."
]
},
{
"cell_type": "markdown",
"id": "e6d510b0-1565-489c-9441-1812153a3a9f",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"source": [
"Beispielstudent:\n",
"\n",
"|Attribut|Wert|\n",
"|-|-|\n",
"|vorname|Martin|\n",
"|nachname|Le|\n",
"|mat_nr|520420|\n",
"|semester|5|"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "36bd4680-e75e-4db0-9442-9c62f393608e",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'mat_nr': 520420,\n",
" 'nachname': 'Le',\n",
" 'semester': 5,\n",
" 'vorname': 'Martin'}\n"
]
}
],
"source": [
"from dataclasses import dataclass, asdict\n",
"\n",
"@dataclass\n",
"class Student:\n",
" vorname: str\n",
" nachname: str\n",
" mat_nr: int\n",
" semester: int \n",
"\n",
"student = Student(\n",
" vorname='Martin',\n",
" nachname='Le',\n",
" mat_nr=520420,\n",
" semester=5)\n",
"\n",
"stud = asdict(student)\n",
"\n",
"from pprint import pprint\n",
"pprint(stud, width=1)"
]
},
{
"cell_type": "markdown",
"id": "c1471211-26a2-4607-82de-9cc706cfc2fb",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "slide"
},
"tags": []
},
"source": [
"### Aufgabe\n",
"\n",
"*6 Punkte*\n",
"\n",
"Gegeben sind zwei Listen `colorn` & `colorv_hex`, welche zueinander Index Sortiert sind.\n",
"\n",
"Schreiben nun eine Dataclass `Color` mit den Attributen `name` & `value` und vergebe geeignete Type Hints.\n",
"\n",
"Erstelle danach eine Liste, welche die Werte aus `colorn` & `colorv_hex` in die Dataclass `Color` umwandeln, und speicher die Liste in der variablen `colors`.\n"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "2abd79b2-2083-422b-a83d-7cd3f03aa82c",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "fragment"
},
"tags": []
},
"outputs": [],
"source": [
"colorn = ['RED', 'GREEN', 'BLUE', 'YELLOW', 'PURPLE']\n",
"colorv_hex = ['#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF']"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "9a82261a-a644-4118-a4f2-e663f10a75bd",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": "subslide"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Color(name='RED', value='#FF0000'),\n",
" Color(name='GREEN', value='#00FF00'),\n",
" Color(name='BLUE', value='#0000FF'),\n",
" Color(name='YELLOW', value='#FFFF00'),\n",
" Color(name='PURPLE', value='#FF00FF')]\n"
]
}
],
"source": [
"colors = None\n",
"\n",
"@dataclass\n",
"class Color:\n",
" name: str\n",
" value: str\n",
"\n",
"colors = [Color(n, w) for n, w in zip(colorn, colorv_hex)]\n",
" \n",
"pprint(colors)"
]
}
],
"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

File diff suppressed because one or more lines are too long

View File

@ -1180,7 +1180,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 3,
"id": "c17338bb-c6df-493c-9d88-0e9ea36a755d",
"metadata": {
"editable": true,
@ -1206,7 +1206,7 @@
},
{
"cell_type": "code",
"execution_count": 118,
"execution_count": 4,
"id": "a367442e-2c8c-4d32-8acb-5bccf94d64fb",
"metadata": {
"nbgrader": {
@ -1257,7 +1257,7 @@
},
{
"cell_type": "code",
"execution_count": 119,
"execution_count": 5,
"id": "d3aac185-2d6e-4b30-b247-89be8aeeab7d",
"metadata": {
"editable": true,
@ -1283,7 +1283,7 @@
},
{
"cell_type": "code",
"execution_count": 120,
"execution_count": 6,
"id": "c377ec37-b382-4f83-a9cc-829a44b7682e",
"metadata": {
"nbgrader": {
@ -1330,20 +1330,19 @@
"\n",
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie die nur die Werte des Dictionaries `my_dict` aus."
"Speichere die Werte des Dictionaries `my_dict` in der Variablen `values`."
]
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 7,
"id": "03f2c31a-04b4-4dc7-ab00-476cec6922ad",
"metadata": {
"editable": true,
"nbgrader": {
"grade": true,
"grade": false,
"grade_id": "cell-f190c63e28ae9e82",
"locked": false,
"points": 1,
"schema_version": 3,
"solution": true,
"task": false
@ -1353,21 +1352,37 @@
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_values(['Apfel', 'Banane', 'Kirsche'])\n"
]
}
],
"outputs": [],
"source": [
"### BEGIN SOLUTION\n",
"print(my_dict.values())\n",
"values = my_dict.values()\n",
"### END SOLUTION"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "441997b9-3d46-4d2f-bb64-56ebbe4f693c",
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-73d4d3b4007a89c6",
"locked": true,
"points": 1,
"schema_version": 3,
"solution": false,
"task": false
}
},
"outputs": [],
"source": [
"# Hier werden ihre Lösungen getestet ...\n",
"### BEGIN HIDDEN TESTS\n",
"for v1, v2 in zip(values, my_dict.values()):\n",
" assert v1 == v2\n",
"### END HIDDEN TESTS"
]
},
{
"cell_type": "markdown",
"id": "6e774e49-895b-4bb2-9436-cddb75a3d46d",
@ -1390,20 +1405,19 @@
"\n",
"**Aufgabe** *1 Punkte*:\n",
"\n",
"Geben Sie die Elemente des Dictionaries `my_dict` mit der Funktion `.items()` aus. "
"Speichern Sie die Elemente des Dictionaries `my_dict`, welche mit der Funktion `.items()` ausgegeben werden, in der Variablen `items`. "
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 16,
"id": "a399cf66-43eb-4749-8864-18c5e4202f79",
"metadata": {
"editable": true,
"nbgrader": {
"grade": true,
"grade": false,
"grade_id": "cell-03afb00cc074d1ef",
"locked": false,
"points": 1,
"schema_version": 3,
"solution": true,
"task": false
@ -1413,21 +1427,37 @@
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dict_items([('apple', 'Apfel'), ('banana', 'Banane'), ('cherry', 'Kirsche')])\n"
]
}
],
"outputs": [],
"source": [
"### BEGIN SOLUTION\n",
"print(my_dict.items())\n",
"items = my_dict.items()\n",
"### END SOLUTION"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "ceebb41b-1e38-458a-9afd-e9f898ef4268",
"metadata": {
"nbgrader": {
"grade": true,
"grade_id": "cell-727afc0671fb1f19",
"locked": true,
"points": 1,
"schema_version": 3,
"solution": false,
"task": false
}
},
"outputs": [],
"source": [
"# Hier werden ihre Lösungen getestet...\n",
"### BEGIN HIDDEN TESTS\n",
"for t1, t2 in zip(items, my_dict.items()):\n",
" assert t1 == t2\n",
"### END HIDDEN TESTS"
]
},
{
"cell_type": "markdown",
"id": "a8d62b7e-ae53-4bd7-a930-84508c3948f9",
@ -1516,9 +1546,7 @@
"outputs": [],
"source": [
"# Hier werden die Loesungen getestet...\n",
"### BEGIN HIDDEN TESTS\n",
"assert successor(1) == 2\n",
"### END HIDDEN TESTS"
"assert successor(1) == 2"
]
},
{
@ -1593,9 +1621,7 @@
"outputs": [],
"source": [
"# Hier werden die Loesungen getestet...\n",
"### BEGIN HIDDEN TESTS\n",
"assert add(1,2) == 3\n",
"### END HIDDEN TESTS"
"assert add(1,2) == 3"
]
},
{
@ -1869,10 +1895,8 @@
"outputs": [],
"source": [
"# Hier werden die Loesungen getestet...\n",
"### BEGIN HIDDEN TESTS\n",
"assert is_odd(2).lower() == \"Gerade Zahl\".lower()\n",
"assert is_odd(3).lower() == \"Ungerade Zahl\".lower()\n",
"### END HIDDEN TESTS"
"assert is_odd(3).lower() == \"Ungerade Zahl\".lower()"
]
},
{

File diff suppressed because it is too large Load Diff

View File

@ -1454,7 +1454,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.7"
}
},
"nbformat": 4,

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,181 @@
species,length,parasites
Fuchsrote Lockensandbiene,13.3,1.0
Fuchsrote Lockensandbiene,12.0,2.0
Fuchsrote Lockensandbiene,13.8,2.0
Fuchsrote Lockensandbiene,13.9,1.0
Fuchsrote Lockensandbiene,11.0,0.0
Fuchsrote Lockensandbiene,11.7,2.0
Fuchsrote Lockensandbiene,13.1,1.0
Fuchsrote Lockensandbiene,12.7,3.0
Fuchsrote Lockensandbiene,13.0,1.0
Fuchsrote Lockensandbiene,12.1,0.0
Fuchsrote Lockensandbiene,13.9,2.0
Fuchsrote Lockensandbiene,13.8,0.0
Fuchsrote Lockensandbiene,13.1,1.0
Fuchsrote Lockensandbiene,14.1,2.0
Fuchsrote Lockensandbiene,13.5,3.0
Fuchsrote Lockensandbiene,12.1,1.0
Fuchsrote Lockensandbiene,13.4,1.0
Fuchsrote Lockensandbiene,12.0,2.0
Fuchsrote Lockensandbiene,13.9,3.0
Fuchsrote Lockensandbiene,13.0,2.0
Fuchsrote Lockensandbiene,12.8,0.0
Fuchsrote Lockensandbiene,12.3,0.0
Fuchsrote Lockensandbiene,14.2,1.0
Fuchsrote Lockensandbiene,12.8,0.0
Fuchsrote Lockensandbiene,12.6,2.0
Fuchsrote Lockensandbiene,12.6,0.0
Fuchsrote Lockensandbiene,13.5,2.0
Fuchsrote Lockensandbiene,13.4,2.0
Fuchsrote Lockensandbiene,13.4,2.0
Fuchsrote Lockensandbiene,13.4,1.0
Fuchsrote Lockensandbiene,15.1,2.0
Fuchsrote Lockensandbiene,12.6,2.0
Fuchsrote Lockensandbiene,12.5,2.0
Fuchsrote Lockensandbiene,12.2,0.0
Fuchsrote Lockensandbiene,13.6,0.0
Fuchsrote Lockensandbiene,14.1,3.0
Fuchsrote Lockensandbiene,12.9,1.0
Fuchsrote Lockensandbiene,12.2,1.0
Fuchsrote Lockensandbiene,12.2,1.0
Fuchsrote Lockensandbiene,13.7,2.0
Fuchsrote Lockensandbiene,13.7,3.0
Fuchsrote Lockensandbiene,13.5,1.0
Fuchsrote Lockensandbiene,12.3,3.0
Fuchsrote Lockensandbiene,13.2,0.0
Fuchsrote Lockensandbiene,13.1,2.0
Fuchsrote Lockensandbiene,13.2,2.0
Fuchsrote Lockensandbiene,13.9,0.0
Fuchsrote Lockensandbiene,13.2,0.0
Fuchsrote Lockensandbiene,13.7,1.0
Fuchsrote Lockensandbiene,13.1,3.0
Fuchsrote Lockensandbiene,13.3,2.0
Fuchsrote Lockensandbiene,13.6,3.0
Fuchsrote Lockensandbiene,11.5,2.0
Fuchsrote Lockensandbiene,12.7,1.0
Fuchsrote Lockensandbiene,12.5,2.0
Fuchsrote Lockensandbiene,12.4,0.0
Fuchsrote Lockensandbiene,12.7,0.0
Fuchsrote Lockensandbiene,14.5,2.0
Fuchsrote Lockensandbiene,12.1,2.0
Fuchsrote Lockensandbiene,14.0,1.0
Ackerhummel,7.0,2.0
Ackerhummel,11.0,2.0
Ackerhummel,12.5,3.0
Ackerhummel,13.8,2.0
Ackerhummel,14.1,2.0
Ackerhummel,14.4,1.0
Ackerhummel,11.0,2.0
Ackerhummel,10.6,3.0
Ackerhummel,14.6,3.0
Ackerhummel,11.4,2.0
Ackerhummel,8.2,1.0
Ackerhummel,8.6,1.0
Ackerhummel,9.2,3.0
Ackerhummel,13.5,3.0
Ackerhummel,12.4,0.0
Ackerhummel,14.1,0.0
Ackerhummel,10.7,2.0
Ackerhummel,12.5,1.0
Ackerhummel,13.9,3.0
Ackerhummel,11.1,1.0
Ackerhummel,13.4,1.0
Ackerhummel,10.0,4.0
Ackerhummel,10.9,1.0
Ackerhummel,10.9,1.0
Ackerhummel,8.4,1.0
Ackerhummel,13.5,0.0
Ackerhummel,10.6,0.0
Ackerhummel,12.0,0.0
Ackerhummel,13.4,1.0
Ackerhummel,13.3,0.0
Ackerhummel,14.0,2.0
Ackerhummel,11.7,3.0
Ackerhummel,10.7,2.0
Ackerhummel,11.8,1.0
Ackerhummel,6.9,2.0
Ackerhummel,7.7,4.0
Ackerhummel,8.0,3.0
Ackerhummel,9.0,0.0
Ackerhummel,13.2,1.0
Ackerhummel,9.3,1.0
Ackerhummel,10.9,1.0
Ackerhummel,15.9,2.0
Ackerhummel,10.9,2.0
Ackerhummel,14.2,0.0
Ackerhummel,9.2,1.0
Ackerhummel,11.4,2.0
Ackerhummel,9.1,0.0
Ackerhummel,11.0,3.0
Ackerhummel,14.5,0.0
Ackerhummel,6.8,4.0
Ackerhummel,13.3,0.0
Ackerhummel,12.7,3.0
Ackerhummel,10.2,4.0
Ackerhummel,7.7,4.0
Ackerhummel,12.2,3.0
Ackerhummel,10.4,3.0
Ackerhummel,12.7,3.0
Ackerhummel,12.1,3.0
Ackerhummel,16.8,1.0
Ackerhummel,11.3,2.0
Platterbsen-Mörtelbiene,13.0,1.0
Platterbsen-Mörtelbiene,14.2,2.0
Platterbsen-Mörtelbiene,14.2,1.0
Platterbsen-Mörtelbiene,15.4,1.0
Platterbsen-Mörtelbiene,14.8,1.0
Platterbsen-Mörtelbiene,14.4,1.0
Platterbsen-Mörtelbiene,15.5,0.0
Platterbsen-Mörtelbiene,12.8,1.0
Platterbsen-Mörtelbiene,13.4,1.0
Platterbsen-Mörtelbiene,13.1,0.0
Platterbsen-Mörtelbiene,13.6,1.0
Platterbsen-Mörtelbiene,12.6,1.0
Platterbsen-Mörtelbiene,14.6,1.0
Platterbsen-Mörtelbiene,13.8,1.0
Platterbsen-Mörtelbiene,12.5,1.0
Platterbsen-Mörtelbiene,13.0,1.0
Platterbsen-Mörtelbiene,14.3,2.0
Platterbsen-Mörtelbiene,14.8,2.0
Platterbsen-Mörtelbiene,16.0,1.0
Platterbsen-Mörtelbiene,16.9,1.0
Platterbsen-Mörtelbiene,14.4,1.0
Platterbsen-Mörtelbiene,13.0,2.0
Platterbsen-Mörtelbiene,11.9,1.0
Platterbsen-Mörtelbiene,14.3,2.0
Platterbsen-Mörtelbiene,13.2,1.0
Platterbsen-Mörtelbiene,13.6,1.0
Platterbsen-Mörtelbiene,13.4,1.0
Platterbsen-Mörtelbiene,13.9,1.0
Platterbsen-Mörtelbiene,15.1,0.0
Platterbsen-Mörtelbiene,14.2,1.0
Platterbsen-Mörtelbiene,13.8,2.0
Platterbsen-Mörtelbiene,13.0,0.0
Platterbsen-Mörtelbiene,12.3,1.0
Platterbsen-Mörtelbiene,13.5,0.0
Platterbsen-Mörtelbiene,13.9,1.0
Platterbsen-Mörtelbiene,15.8,0.0
Platterbsen-Mörtelbiene,14.1,2.0
Platterbsen-Mörtelbiene,15.0,0.0
Platterbsen-Mörtelbiene,13.5,2.0
Platterbsen-Mörtelbiene,12.8,2.0
Platterbsen-Mörtelbiene,13.0,1.0
Platterbsen-Mörtelbiene,13.3,2.0
Platterbsen-Mörtelbiene,16.1,2.0
Platterbsen-Mörtelbiene,13.2,2.0
Platterbsen-Mörtelbiene,14.8,1.0
Platterbsen-Mörtelbiene,13.1,1.0
Platterbsen-Mörtelbiene,14.9,0.0
Platterbsen-Mörtelbiene,14.4,1.0
Platterbsen-Mörtelbiene,13.8,0.0
Platterbsen-Mörtelbiene,14.0,1.0
Platterbsen-Mörtelbiene,13.3,1.0
Platterbsen-Mörtelbiene,14.4,1.0
Platterbsen-Mörtelbiene,13.5,1.0
Platterbsen-Mörtelbiene,12.8,2.0
Platterbsen-Mörtelbiene,12.7,2.0
Platterbsen-Mörtelbiene,14.2,1.0
Platterbsen-Mörtelbiene,15.6,1.0
Platterbsen-Mörtelbiene,14.2,2.0
Platterbsen-Mörtelbiene,13.9,0.0
Platterbsen-Mörtelbiene,14.3,0.0
1 species length parasites
2 Fuchsrote Lockensandbiene 13.3 1.0
3 Fuchsrote Lockensandbiene 12.0 2.0
4 Fuchsrote Lockensandbiene 13.8 2.0
5 Fuchsrote Lockensandbiene 13.9 1.0
6 Fuchsrote Lockensandbiene 11.0 0.0
7 Fuchsrote Lockensandbiene 11.7 2.0
8 Fuchsrote Lockensandbiene 13.1 1.0
9 Fuchsrote Lockensandbiene 12.7 3.0
10 Fuchsrote Lockensandbiene 13.0 1.0
11 Fuchsrote Lockensandbiene 12.1 0.0
12 Fuchsrote Lockensandbiene 13.9 2.0
13 Fuchsrote Lockensandbiene 13.8 0.0
14 Fuchsrote Lockensandbiene 13.1 1.0
15 Fuchsrote Lockensandbiene 14.1 2.0
16 Fuchsrote Lockensandbiene 13.5 3.0
17 Fuchsrote Lockensandbiene 12.1 1.0
18 Fuchsrote Lockensandbiene 13.4 1.0
19 Fuchsrote Lockensandbiene 12.0 2.0
20 Fuchsrote Lockensandbiene 13.9 3.0
21 Fuchsrote Lockensandbiene 13.0 2.0
22 Fuchsrote Lockensandbiene 12.8 0.0
23 Fuchsrote Lockensandbiene 12.3 0.0
24 Fuchsrote Lockensandbiene 14.2 1.0
25 Fuchsrote Lockensandbiene 12.8 0.0
26 Fuchsrote Lockensandbiene 12.6 2.0
27 Fuchsrote Lockensandbiene 12.6 0.0
28 Fuchsrote Lockensandbiene 13.5 2.0
29 Fuchsrote Lockensandbiene 13.4 2.0
30 Fuchsrote Lockensandbiene 13.4 2.0
31 Fuchsrote Lockensandbiene 13.4 1.0
32 Fuchsrote Lockensandbiene 15.1 2.0
33 Fuchsrote Lockensandbiene 12.6 2.0
34 Fuchsrote Lockensandbiene 12.5 2.0
35 Fuchsrote Lockensandbiene 12.2 0.0
36 Fuchsrote Lockensandbiene 13.6 0.0
37 Fuchsrote Lockensandbiene 14.1 3.0
38 Fuchsrote Lockensandbiene 12.9 1.0
39 Fuchsrote Lockensandbiene 12.2 1.0
40 Fuchsrote Lockensandbiene 12.2 1.0
41 Fuchsrote Lockensandbiene 13.7 2.0
42 Fuchsrote Lockensandbiene 13.7 3.0
43 Fuchsrote Lockensandbiene 13.5 1.0
44 Fuchsrote Lockensandbiene 12.3 3.0
45 Fuchsrote Lockensandbiene 13.2 0.0
46 Fuchsrote Lockensandbiene 13.1 2.0
47 Fuchsrote Lockensandbiene 13.2 2.0
48 Fuchsrote Lockensandbiene 13.9 0.0
49 Fuchsrote Lockensandbiene 13.2 0.0
50 Fuchsrote Lockensandbiene 13.7 1.0
51 Fuchsrote Lockensandbiene 13.1 3.0
52 Fuchsrote Lockensandbiene 13.3 2.0
53 Fuchsrote Lockensandbiene 13.6 3.0
54 Fuchsrote Lockensandbiene 11.5 2.0
55 Fuchsrote Lockensandbiene 12.7 1.0
56 Fuchsrote Lockensandbiene 12.5 2.0
57 Fuchsrote Lockensandbiene 12.4 0.0
58 Fuchsrote Lockensandbiene 12.7 0.0
59 Fuchsrote Lockensandbiene 14.5 2.0
60 Fuchsrote Lockensandbiene 12.1 2.0
61 Fuchsrote Lockensandbiene 14.0 1.0
62 Ackerhummel 7.0 2.0
63 Ackerhummel 11.0 2.0
64 Ackerhummel 12.5 3.0
65 Ackerhummel 13.8 2.0
66 Ackerhummel 14.1 2.0
67 Ackerhummel 14.4 1.0
68 Ackerhummel 11.0 2.0
69 Ackerhummel 10.6 3.0
70 Ackerhummel 14.6 3.0
71 Ackerhummel 11.4 2.0
72 Ackerhummel 8.2 1.0
73 Ackerhummel 8.6 1.0
74 Ackerhummel 9.2 3.0
75 Ackerhummel 13.5 3.0
76 Ackerhummel 12.4 0.0
77 Ackerhummel 14.1 0.0
78 Ackerhummel 10.7 2.0
79 Ackerhummel 12.5 1.0
80 Ackerhummel 13.9 3.0
81 Ackerhummel 11.1 1.0
82 Ackerhummel 13.4 1.0
83 Ackerhummel 10.0 4.0
84 Ackerhummel 10.9 1.0
85 Ackerhummel 10.9 1.0
86 Ackerhummel 8.4 1.0
87 Ackerhummel 13.5 0.0
88 Ackerhummel 10.6 0.0
89 Ackerhummel 12.0 0.0
90 Ackerhummel 13.4 1.0
91 Ackerhummel 13.3 0.0
92 Ackerhummel 14.0 2.0
93 Ackerhummel 11.7 3.0
94 Ackerhummel 10.7 2.0
95 Ackerhummel 11.8 1.0
96 Ackerhummel 6.9 2.0
97 Ackerhummel 7.7 4.0
98 Ackerhummel 8.0 3.0
99 Ackerhummel 9.0 0.0
100 Ackerhummel 13.2 1.0
101 Ackerhummel 9.3 1.0
102 Ackerhummel 10.9 1.0
103 Ackerhummel 15.9 2.0
104 Ackerhummel 10.9 2.0
105 Ackerhummel 14.2 0.0
106 Ackerhummel 9.2 1.0
107 Ackerhummel 11.4 2.0
108 Ackerhummel 9.1 0.0
109 Ackerhummel 11.0 3.0
110 Ackerhummel 14.5 0.0
111 Ackerhummel 6.8 4.0
112 Ackerhummel 13.3 0.0
113 Ackerhummel 12.7 3.0
114 Ackerhummel 10.2 4.0
115 Ackerhummel 7.7 4.0
116 Ackerhummel 12.2 3.0
117 Ackerhummel 10.4 3.0
118 Ackerhummel 12.7 3.0
119 Ackerhummel 12.1 3.0
120 Ackerhummel 16.8 1.0
121 Ackerhummel 11.3 2.0
122 Platterbsen-Mörtelbiene 13.0 1.0
123 Platterbsen-Mörtelbiene 14.2 2.0
124 Platterbsen-Mörtelbiene 14.2 1.0
125 Platterbsen-Mörtelbiene 15.4 1.0
126 Platterbsen-Mörtelbiene 14.8 1.0
127 Platterbsen-Mörtelbiene 14.4 1.0
128 Platterbsen-Mörtelbiene 15.5 0.0
129 Platterbsen-Mörtelbiene 12.8 1.0
130 Platterbsen-Mörtelbiene 13.4 1.0
131 Platterbsen-Mörtelbiene 13.1 0.0
132 Platterbsen-Mörtelbiene 13.6 1.0
133 Platterbsen-Mörtelbiene 12.6 1.0
134 Platterbsen-Mörtelbiene 14.6 1.0
135 Platterbsen-Mörtelbiene 13.8 1.0
136 Platterbsen-Mörtelbiene 12.5 1.0
137 Platterbsen-Mörtelbiene 13.0 1.0
138 Platterbsen-Mörtelbiene 14.3 2.0
139 Platterbsen-Mörtelbiene 14.8 2.0
140 Platterbsen-Mörtelbiene 16.0 1.0
141 Platterbsen-Mörtelbiene 16.9 1.0
142 Platterbsen-Mörtelbiene 14.4 1.0
143 Platterbsen-Mörtelbiene 13.0 2.0
144 Platterbsen-Mörtelbiene 11.9 1.0
145 Platterbsen-Mörtelbiene 14.3 2.0
146 Platterbsen-Mörtelbiene 13.2 1.0
147 Platterbsen-Mörtelbiene 13.6 1.0
148 Platterbsen-Mörtelbiene 13.4 1.0
149 Platterbsen-Mörtelbiene 13.9 1.0
150 Platterbsen-Mörtelbiene 15.1 0.0
151 Platterbsen-Mörtelbiene 14.2 1.0
152 Platterbsen-Mörtelbiene 13.8 2.0
153 Platterbsen-Mörtelbiene 13.0 0.0
154 Platterbsen-Mörtelbiene 12.3 1.0
155 Platterbsen-Mörtelbiene 13.5 0.0
156 Platterbsen-Mörtelbiene 13.9 1.0
157 Platterbsen-Mörtelbiene 15.8 0.0
158 Platterbsen-Mörtelbiene 14.1 2.0
159 Platterbsen-Mörtelbiene 15.0 0.0
160 Platterbsen-Mörtelbiene 13.5 2.0
161 Platterbsen-Mörtelbiene 12.8 2.0
162 Platterbsen-Mörtelbiene 13.0 1.0
163 Platterbsen-Mörtelbiene 13.3 2.0
164 Platterbsen-Mörtelbiene 16.1 2.0
165 Platterbsen-Mörtelbiene 13.2 2.0
166 Platterbsen-Mörtelbiene 14.8 1.0
167 Platterbsen-Mörtelbiene 13.1 1.0
168 Platterbsen-Mörtelbiene 14.9 0.0
169 Platterbsen-Mörtelbiene 14.4 1.0
170 Platterbsen-Mörtelbiene 13.8 0.0
171 Platterbsen-Mörtelbiene 14.0 1.0
172 Platterbsen-Mörtelbiene 13.3 1.0
173 Platterbsen-Mörtelbiene 14.4 1.0
174 Platterbsen-Mörtelbiene 13.5 1.0
175 Platterbsen-Mörtelbiene 12.8 2.0
176 Platterbsen-Mörtelbiene 12.7 2.0
177 Platterbsen-Mörtelbiene 14.2 1.0
178 Platterbsen-Mörtelbiene 15.6 1.0
179 Platterbsen-Mörtelbiene 14.2 2.0
180 Platterbsen-Mörtelbiene 13.9 0.0
181 Platterbsen-Mörtelbiene 14.3 0.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
University name,Type of university,Sponsorship,Right of promotion,Founding year,Number of students,Address,lat,lon,plz,pic
Hochschule für Bildende Künste Braunschweig,Artistic university,public,yes,1963,976,Johannes-Selenka-Platz 1,52.2577384,10.5023145,38118 Braunschweig,https://www.hbk-bs.de/fileadmin/_processed_/5/1/csm_HBK_Logo_9f3f898a2b.png
Technische Universität Carolo-Wilhelmina zu Braunschweig,University,public,yes,1745,17709,Universitätspl. 2,52.27355,10.530097,38106 Braunschweig,https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Siegel_TU_Braunschweig_transparent.svg/1200px-Siegel_TU_Braunschweig_transparent.svg.png
Hochschule 21,University of Applied Sciences,privat,no,2005,1084,Harburger Str. 6,53.47765,9.70465,21614 Buxtehude,https://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Hochschule_21_logo.svg/2560px-Hochschule_21_logo.svg.png
Technische Universität Clausthal,University,public,yes,1775,3446,Adolph-Roemer-Straße 2A,51.80484,10.33411,38678 Clausthal-Zellerfeld,https://www.presse.tu-clausthal.de/fileadmin/TU_Clausthal/images/CorporateDesign/Logo/Logo_TUC_en_RGB_gross.gif
Hochschule Emden/Leer,University of Applied Sciences,public,no,2009,4481,Constantiapl. 4,53.36816,7.18141,26723 Emden,https://sta-hisweb.hs-emden-leer.de/QIS/images//logo_el.jpg
PFH Private Hochschule Göttingen,University of Applied Sciences,privat,no,1995,4226,Weender Landstraße 3-7,51.53891,9.93322,37073 Göttingen,https://goettingen-campus.de/fileadmin/_processed_/d/7/csm_logopfh_20f8eee765.jpg
Georg-August-Universität Göttingen,University,public,yes,1737,28614,Wilhelmsplatz 1,51.53407,9.93785,37073 Göttingen,https://upload.wikimedia.org/wikipedia/commons/c/c0/Logo_Uni_G%C3%B6ttingen_2022.png
Fachhochschule für die Wirtschaft Hannover,University of Applied Sciences,privat,no,1996,641,Freundallee 15,52.3662,9.77247,30173 Hannover,https://upload.wikimedia.org/wikipedia/commons/5/5c/Fachhochschule_f%C3%BCr_die_Wirtschaft_logo.svg
Hochschule Hannover,University of Applied Sciences,public,no,1971,9209,Ricklinger Stadtweg 120,52.35419,9.72238,30459 Hannover,https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/HsH_Logo.svg/1200px-HsH_Logo.svg.png
"Hochschule für Musik, Theater und Medien Hannover",Artistic university,public,yes,1897,1409,Neues Haus 1,52.37738,9.75392,30175 Hannover,https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/HMTM-Logo-2010.svg/1200px-HMTM-Logo-2010.svg.png
Leibniz-Fachhochschule,University of Applied Sciences,privat,no,1920,589,Expo Plaza 11,52.32115,9.81868,30539 Hannover,https://www.visit-hannover.com/var/storage/images/_aliases/image_full/media/01-data-neu/bilder/redaktion-hannover.de/portale/initiative-wissenschaft/leibniz-fh/leibniz-fachhochschule-logo/8135360-1-ger-DE/Leibniz-Fachhochschule-Logo.jpg
Medizinische Hochschule Hannover (MHH),University,public,yes,1963,3778,Carl-Neuberg-Straße 1,52.38405,9.80603,30625 Hannover,https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Medizinische_Hochschule_Hannover_logo.svg/2560px-Medizinische_Hochschule_Hannover_logo.svg.png
Stiftung Tierärztliche Hochschule Hannover,University,public,yes,1778,2381,Bünteweg 2,52.35468,9.79773,30559 Hannover,https://upload.wikimedia.org/wikipedia/de/thumb/5/59/Tier%C3%A4rztliche_Hochschule_Hannover_logo.svg/1200px-Tier%C3%A4rztliche_Hochschule_Hannover_logo.svg.png
Gottfried Wilhelm Leibniz Universität Hannover,University,public,yes,1831,28935,Welfengarten 1,52.38225,9.71777,30167 Hannover,https://www.uni-hannover.de/fileadmin/_processed_/1/5/csm_luh-logo-3x2_8dea6c08fc.jpg
Fachhochschule für Interkulturelle Theologie Hermannsburg,University of Applied Sciences,privat,no,2012,91,Missionsstraße 3-5,52.708843,10.14071,29320 Südheide,https://cdn.max-e5.info/damfiles/logo/fh_hermannsburg/fh_hermannsburg/Kopfgrafik/Logo-FIT--weiss.jpg-b5f510cb468ab8840e0f2e62b703208e.jpg
Universität Hildesheim,University,public,yes,1978,8378,Universitätspl. 1,52.13401,9.97469,31141 Hildesheim,https://www.uni-hildesheim.de/media/_processed_/d/8/csm_Bildkombo_Logo_Uni_Hildesheim-1850_8fd99cc21e.jpg
HAWK Hochschule für angewandte Wissenschaft und Kunst Hildesheim,University of Applied Sciences,public,no,1971,6495,Hohnsen 4,52.14246,9.95798,31134 Hildesheim,https://upload.wikimedia.org/wikipedia/commons/0/02/HAWK-Logo.jpg
HAWK Hochschule für angewandte Wissenschaft und Kunst Holzminden,University of Applied Sciences,public,no,1971,6495,Haarmannpl. 3,51.82726,9.45069,37603 Holzminden,https://upload.wikimedia.org/wikipedia/commons/0/02/HAWK-Logo.jpg
HAWK Hochschule für angewandte Wissenschaft und Kunst Göttingen,University of Applied Sciences,public,no,1971,6495,Von-Ossietzky-Straße 99,51.52175,9.96967,37085 Göttingen,https://upload.wikimedia.org/wikipedia/commons/0/02/HAWK-Logo.jpg
Leuphana Universität Lüneburg,University,public,yes,1946,6497,Universitätsallee 1,53.228531,10.40171,21335 Lüneburg,https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Leuphana_Universit%C3%A4t_L%C3%BCneburg_Logo_2020.svg/2560px-Leuphana_Universit%C3%A4t_L%C3%BCneburg_Logo_2020.svg.png
Norddeutsche Hochschule für Rechtspflege Niedersachsen,University of Administration,public,no,2007,6409,Godehardspl. 6,52.14484,9.94923,31134 Hildesheim,https://static.studycheck.de/media/images/institute_logos/small/hr-nord.jpg
Kommunale Hochschule für Verwaltung in Niedersachsen,University of Administration,public,no,2007,1570,Wielandstraße 8,52.3705,9.72239,30169 Hannover,https://www.nsi-hsvn.de/fileadmin/user_upload/02_Studium/big-hsvn_logo.png
"Carl von Ossietzky Universität Oldenburg
",University,public,yes,1973,15635,Uhlhornsweg 49-55,53.14734,8.17902,26129 Oldenburg,https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Carl_von_Ossietzky_Universit%C3%A4t_Oldenburg_logo.svg/1200px-Carl_von_Ossietzky_Universit%C3%A4t_Oldenburg_logo.svg.png
Hochschule Osnabrück,University of Applied Sciences,public,no,1971,13620,Albrechtstraße 30,52.28268,8.02501,49076 Osnabrück,https://login.hs-osnabrueck.de/nidp/hsos/images/hsos-logo.png
Universität Osnabrück,University,public,yes,1973,13640,Neuer Graben 29,52.27137,8.04454,49074 Osnabrück,https://www.eh-tabor.de/sites/default/files/styles/width980px/public/logo-universitaet-osnabrueck.png?itok=DmZEq9ka
"Hochschule Braunschweig/Wolfenbüttel, Ostfalia Hochschule für angewandte Wissenschaften",University of Applied Sciences,public,no,1971,11577,Salzdahlumer Str. 46/48,52.17683,10.54865,38302 Wolfenbüttel,https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
"Hochschule Wolfsburg, Ostfalia Hochschule für angewandte Wissenschaften",University of Applied Sciences,public,no,1971,11577,Robert-Koch-Platz 8A,52.42595,10.78711,38440 Wolfsburg,https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
"Hochschule Suderburg, Ostfalia Hochschule für angewandte Wissenschaften",University of Applied Sciences,public,no,1971,11577,Herbert-Meyer-Straße 7,52.89761,10.44659,29556 Suderburg,https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
"Hochschule Salzgitter, Ostfalia Hochschule für angewandte Wissenschaften",University of Applied Sciences,public,no,1971,11577,Karl-Scharfenberg-Straße 55/57,52.08724,10.38055,38229 Salzgitter,https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
"Hochschule für Künste im Sozialen, Ottersberg",University of Applied Sciences,privat,no,1967,342,Große Str. 107,53.10668,9.1631,28870 Ottersberg,https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/Logo_HKS_Ottersberg.svg/1200px-Logo_HKS_Ottersberg.svg.png
Private Hochschule für Wirtschaft und Technik Vechta,University of Applied Sciences,privat,no,1998,558,Rombergstraße 40,52.72125,8.27891,49377 Vechta,https://www.phwt.de/wp-content/uploads/2020/09/phwt-logo-free.png
Private Hochschule für Wirtschaft und Technik Diepholz,University of Applied Sciences,privat,no,1998,558,Schlesier Str. 13A,52.61171,8.36334,49356 Diepholz,https://www.phwt.de/wp-content/uploads/2020/09/phwt-logo-free.png
Universität Vechta,University,public,yes,1995,4.551,Driverstraße 22,52.72117,8.2938,49377 Vechta,https://upload.wikimedia.org/wikipedia/commons/0/08/Logo_Uni_Vechta-neu.png
Hochschule Weserbergland,University of Applied Sciences,privat,no,2010,485,Am Stockhof 2,52.09875,9.35542,31785 Hameln,https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/Hochschule_Weserbergland_logo.svg/1200px-Hochschule_Weserbergland_logo.svg.png
Jade Hochschule Wilhelmshaven,University of Applied Sciences,public,no,2009,6789,Friedrich-Paffrath-Straße 101,53.54787,8.08804,26389 Wilhelmshaven,https://www.jade-hs.de/fileadmin/layout2016/assets/jadehs-logo.png
Jade Hochschule Oldenburg,University of Applied Sciences,public,no,2009,6789,Ofener Str. 16/19,53.14179,8.20213,26121 Oldenburg,https://www.jade-hs.de/fileadmin/layout2016/assets/jadehs-logo.png
Jade Hochschule Elsfleth,University of Applied Sciences,public,no,2009,6789,Weserstraße 52,53.24244,8.46651,26931 Elsfleth,https://www.jade-hs.de/fileadmin/layout2016/assets/jadehs-logo.png
Steuerakademie Niedersachsen Rinteln,University of Administration,public,no,2006,500,Wilhelm-Busch-Weg 29,52.20696,9.09112,31737 Rinteln,https://www.steuerakademie.niedersachsen.de/assets/image/232/85611
Steuerakademie Niedersachsen Bad Eilsen,University of Administration,public,no,2006,500,Bahnhofstraße 5,52.23981,9.10423,31707 Bad Eilsen,https://www.steuerakademie.niedersachsen.de/assets/image/232/85611
1 University name Type of university Sponsorship Right of promotion Founding year Number of students Address lat lon plz pic
2 Hochschule für Bildende Künste Braunschweig Artistic university public yes 1963 976 Johannes-Selenka-Platz 1 52.2577384 10.5023145 38118 Braunschweig https://www.hbk-bs.de/fileadmin/_processed_/5/1/csm_HBK_Logo_9f3f898a2b.png
3 Technische Universität Carolo-Wilhelmina zu Braunschweig University public yes 1745 17709 Universitätspl. 2 52.27355 10.530097 38106 Braunschweig https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Siegel_TU_Braunschweig_transparent.svg/1200px-Siegel_TU_Braunschweig_transparent.svg.png
4 Hochschule 21 University of Applied Sciences privat no 2005 1084 Harburger Str. 6 53.47765 9.70465 21614 Buxtehude https://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Hochschule_21_logo.svg/2560px-Hochschule_21_logo.svg.png
5 Technische Universität Clausthal University public yes 1775 3446 Adolph-Roemer-Straße 2A 51.80484 10.33411 38678 Clausthal-Zellerfeld https://www.presse.tu-clausthal.de/fileadmin/TU_Clausthal/images/CorporateDesign/Logo/Logo_TUC_en_RGB_gross.gif
6 Hochschule Emden/Leer University of Applied Sciences public no 2009 4481 Constantiapl. 4 53.36816 7.18141 26723 Emden https://sta-hisweb.hs-emden-leer.de/QIS/images//logo_el.jpg
7 PFH – Private Hochschule Göttingen University of Applied Sciences privat no 1995 4226 Weender Landstraße 3-7 51.53891 9.93322 37073 Göttingen https://goettingen-campus.de/fileadmin/_processed_/d/7/csm_logopfh_20f8eee765.jpg
8 Georg-August-Universität Göttingen University public yes 1737 28614 Wilhelmsplatz 1 51.53407 9.93785 37073 Göttingen https://upload.wikimedia.org/wikipedia/commons/c/c0/Logo_Uni_G%C3%B6ttingen_2022.png
9 Fachhochschule für die Wirtschaft Hannover University of Applied Sciences privat no 1996 641 Freundallee 15 52.3662 9.77247 30173 Hannover https://upload.wikimedia.org/wikipedia/commons/5/5c/Fachhochschule_f%C3%BCr_die_Wirtschaft_logo.svg
10 Hochschule Hannover University of Applied Sciences public no 1971 9209 Ricklinger Stadtweg 120 52.35419 9.72238 30459 Hannover https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/HsH_Logo.svg/1200px-HsH_Logo.svg.png
11 Hochschule für Musik, Theater und Medien Hannover Artistic university public yes 1897 1409 Neues Haus 1 52.37738 9.75392 30175 Hannover https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/HMTM-Logo-2010.svg/1200px-HMTM-Logo-2010.svg.png
12 Leibniz-Fachhochschule University of Applied Sciences privat no 1920 589 Expo Plaza 11 52.32115 9.81868 30539 Hannover https://www.visit-hannover.com/var/storage/images/_aliases/image_full/media/01-data-neu/bilder/redaktion-hannover.de/portale/initiative-wissenschaft/leibniz-fh/leibniz-fachhochschule-logo/8135360-1-ger-DE/Leibniz-Fachhochschule-Logo.jpg
13 Medizinische Hochschule Hannover (MHH) University public yes 1963 3778 Carl-Neuberg-Straße 1 52.38405 9.80603 30625 Hannover https://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Medizinische_Hochschule_Hannover_logo.svg/2560px-Medizinische_Hochschule_Hannover_logo.svg.png
14 Stiftung Tierärztliche Hochschule Hannover University public yes 1778 2381 Bünteweg 2 52.35468 9.79773 30559 Hannover https://upload.wikimedia.org/wikipedia/de/thumb/5/59/Tier%C3%A4rztliche_Hochschule_Hannover_logo.svg/1200px-Tier%C3%A4rztliche_Hochschule_Hannover_logo.svg.png
15 Gottfried Wilhelm Leibniz Universität Hannover University public yes 1831 28935 Welfengarten 1 52.38225 9.71777 30167 Hannover https://www.uni-hannover.de/fileadmin/_processed_/1/5/csm_luh-logo-3x2_8dea6c08fc.jpg
16 Fachhochschule für Interkulturelle Theologie Hermannsburg University of Applied Sciences privat no 2012 91 Missionsstraße 3-5 52.708843 10.14071 29320 Südheide https://cdn.max-e5.info/damfiles/logo/fh_hermannsburg/fh_hermannsburg/Kopfgrafik/Logo-FIT--weiss.jpg-b5f510cb468ab8840e0f2e62b703208e.jpg
17 Universität Hildesheim University public yes 1978 8378 Universitätspl. 1 52.13401 9.97469 31141 Hildesheim https://www.uni-hildesheim.de/media/_processed_/d/8/csm_Bildkombo_Logo_Uni_Hildesheim-1850_8fd99cc21e.jpg
18 HAWK Hochschule für angewandte Wissenschaft und Kunst Hildesheim University of Applied Sciences public no 1971 6495 Hohnsen 4 52.14246 9.95798 31134 Hildesheim https://upload.wikimedia.org/wikipedia/commons/0/02/HAWK-Logo.jpg
19 HAWK Hochschule für angewandte Wissenschaft und Kunst Holzminden University of Applied Sciences public no 1971 6495 Haarmannpl. 3 51.82726 9.45069 37603 Holzminden https://upload.wikimedia.org/wikipedia/commons/0/02/HAWK-Logo.jpg
20 HAWK Hochschule für angewandte Wissenschaft und Kunst Göttingen University of Applied Sciences public no 1971 6495 Von-Ossietzky-Straße 99 51.52175 9.96967 37085 Göttingen https://upload.wikimedia.org/wikipedia/commons/0/02/HAWK-Logo.jpg
21 Leuphana Universität Lüneburg University public yes 1946 6497 Universitätsallee 1 53.228531 10.40171 21335 Lüneburg https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Leuphana_Universit%C3%A4t_L%C3%BCneburg_Logo_2020.svg/2560px-Leuphana_Universit%C3%A4t_L%C3%BCneburg_Logo_2020.svg.png
22 Norddeutsche Hochschule für Rechtspflege – Niedersachsen University of Administration public no 2007 6409 Godehardspl. 6 52.14484 9.94923 31134 Hildesheim https://static.studycheck.de/media/images/institute_logos/small/hr-nord.jpg
23 Kommunale Hochschule für Verwaltung in Niedersachsen University of Administration public no 2007 1570 Wielandstraße 8 52.3705 9.72239 30169 Hannover https://www.nsi-hsvn.de/fileadmin/user_upload/02_Studium/big-hsvn_logo.png
24 Carl von Ossietzky Universität Oldenburg University public yes 1973 15635 Uhlhornsweg 49-55 53.14734 8.17902 26129 Oldenburg https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Carl_von_Ossietzky_Universit%C3%A4t_Oldenburg_logo.svg/1200px-Carl_von_Ossietzky_Universit%C3%A4t_Oldenburg_logo.svg.png
25 Hochschule Osnabrück University of Applied Sciences public no 1971 13620 Albrechtstraße 30 52.28268 8.02501 49076 Osnabrück https://login.hs-osnabrueck.de/nidp/hsos/images/hsos-logo.png
26 Universität Osnabrück University public yes 1973 13640 Neuer Graben 29 52.27137 8.04454 49074 Osnabrück https://www.eh-tabor.de/sites/default/files/styles/width980px/public/logo-universitaet-osnabrueck.png?itok=DmZEq9ka
27 Hochschule Braunschweig/Wolfenbüttel, Ostfalia Hochschule für angewandte Wissenschaften University of Applied Sciences public no 1971 11577 Salzdahlumer Str. 46/48 52.17683 10.54865 38302 Wolfenbüttel https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
28 Hochschule Wolfsburg, Ostfalia Hochschule für angewandte Wissenschaften University of Applied Sciences public no 1971 11577 Robert-Koch-Platz 8A 52.42595 10.78711 38440 Wolfsburg https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
29 Hochschule Suderburg, Ostfalia Hochschule für angewandte Wissenschaften University of Applied Sciences public no 1971 11577 Herbert-Meyer-Straße 7 52.89761 10.44659 29556 Suderburg https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
30 Hochschule Salzgitter, Ostfalia Hochschule für angewandte Wissenschaften University of Applied Sciences public no 1971 11577 Karl-Scharfenberg-Straße 55/57 52.08724 10.38055 38229 Salzgitter https://www.ostfalia.de/export/system/modules/de.ostfalia.module.template/resources/images/logo/Ostfalia_German.png_230952558.png
31 Hochschule für Künste im Sozialen, Ottersberg University of Applied Sciences privat no 1967 342 Große Str. 107 53.10668 9.1631 28870 Ottersberg https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/Logo_HKS_Ottersberg.svg/1200px-Logo_HKS_Ottersberg.svg.png
32 Private Hochschule für Wirtschaft und Technik Vechta University of Applied Sciences privat no 1998 558 Rombergstraße 40 52.72125 8.27891 49377 Vechta https://www.phwt.de/wp-content/uploads/2020/09/phwt-logo-free.png
33 Private Hochschule für Wirtschaft und Technik Diepholz University of Applied Sciences privat no 1998 558 Schlesier Str. 13A 52.61171 8.36334 49356 Diepholz https://www.phwt.de/wp-content/uploads/2020/09/phwt-logo-free.png
34 Universität Vechta University public yes 1995 4.551 Driverstraße 22 52.72117 8.2938 49377 Vechta https://upload.wikimedia.org/wikipedia/commons/0/08/Logo_Uni_Vechta-neu.png
35 Hochschule Weserbergland University of Applied Sciences privat no 2010 485 Am Stockhof 2 52.09875 9.35542 31785 Hameln https://upload.wikimedia.org/wikipedia/commons/thumb/0/04/Hochschule_Weserbergland_logo.svg/1200px-Hochschule_Weserbergland_logo.svg.png
36 Jade Hochschule – Wilhelmshaven University of Applied Sciences public no 2009 6789 Friedrich-Paffrath-Straße 101 53.54787 8.08804 26389 Wilhelmshaven https://www.jade-hs.de/fileadmin/layout2016/assets/jadehs-logo.png
37 Jade Hochschule – Oldenburg University of Applied Sciences public no 2009 6789 Ofener Str. 16/19 53.14179 8.20213 26121 Oldenburg https://www.jade-hs.de/fileadmin/layout2016/assets/jadehs-logo.png
38 Jade Hochschule – Elsfleth University of Applied Sciences public no 2009 6789 Weserstraße 52 53.24244 8.46651 26931 Elsfleth https://www.jade-hs.de/fileadmin/layout2016/assets/jadehs-logo.png
39 Steuerakademie Niedersachsen Rinteln University of Administration public no 2006 500 Wilhelm-Busch-Weg 29 52.20696 9.09112 31737 Rinteln https://www.steuerakademie.niedersachsen.de/assets/image/232/85611
40 Steuerakademie Niedersachsen Bad Eilsen University of Administration public no 2006 500 Bahnhofstraße 5 52.23981 9.10423 31707 Bad Eilsen https://www.steuerakademie.niedersachsen.de/assets/image/232/85611