-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:digital-sustainability/Grundkurs-Pr…
…ogrammieren
- Loading branch information
Showing
12 changed files
with
239 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
"* Sie verstehen wie in einem Quelltext eine Fallunterscheidung mit einem **If Statement** gemacht werden kann\n", | ||
"* Sie verstehen den Einfluss der Reihenfolge von **Elif Statements**\n", | ||
"* Sie können einzelne Bedingungen **verschachteln**\n", | ||
"* Sie können neue Listen mit Hilfe der **List Comprehension** erstellen" | ||
"* Sie können neue Listen mit Hilfe der **List Comprehensions** erstellen" | ||
] | ||
}, | ||
{ | ||
|
@@ -258,7 +258,7 @@ | |
"tags": [] | ||
}, | ||
"source": [ | ||
"Der Grund dafür ist, dass sich '0.1', '0.2' und '0.3' im Binärsystem (in dem der Computer rechnet) nicht exakt repräsentieren lassen." | ||
"Der Grund dafür ist, dass sich '0.1', '0.2' und '0.3' im Binärsystem (in dem der Computer rechnet) nicht exakt repräsentieren lassen, ähnlich wie sich 1/3 im Zehnersystem nicht exakt repräsentieren lässt ($\\frac{1}{3} \\approx 0.3333$)." | ||
] | ||
}, | ||
{ | ||
|
@@ -312,7 +312,7 @@ | |
}, | ||
"source": [ | ||
"```python\n", | ||
"if bedingung == True:\n", | ||
"if bedingung:\n", | ||
" nur ausführen wenn bedingung == True\n", | ||
" nur ausführen wenn bedingung == True\n", | ||
"immer ausführen\n", | ||
|
@@ -356,7 +356,7 @@ | |
"source": [ | ||
"<div class=\"gk-exercise\">\n", | ||
"\n", | ||
"Frage die Benutzerin nach einer Zahl. Überprüfe ob die Zahl gerade ist und falls ja gib einen entsprechenden Text aus.\n", | ||
"Frage die Benutzerin nach einer Zahl. Überprüfe ob die Zahl gerade ist und falls ja, gib einen entsprechenden Text aus.\n", | ||
" \n", | ||
"<details>\n", | ||
"<summary>Tipps:</summary>\n", | ||
|
@@ -521,10 +521,10 @@ | |
" \n", | ||
"<details>\n", | ||
"<summary>Tipps:</summary>\n", | ||
" Um von <code>0</code> bis und mit <code>n</code> zu summieren muss <a href=\"../03_14_25/Strings_For.ipynb#Zahlen-und-Schleifen\"><code>range(n+1)</code></a> verwendet werden.\n", | ||
" <p>Um von <code>0</code> bis und mit <code>n</code> zu summieren muss <a href=\"../03_14_25/Strings_For.ipynb#Zahlen-und-Schleifen\"><code>range(n+1)</code></a> verwendet werden.</p>\n", | ||
" <details>\n", | ||
" <summary>Tipp:</summary>\n", | ||
" <p>Verwende <a href=\"../03_14_25/Strings_For.ipynb#Error-handling\"><code>try</code> und <code>except</code></a> um fehlerhafte Eingaben abzufangen</p>\n", | ||
" <p>Um eine Variable <code>x</code> um <code>y</code> zu erhöhen, verwende <code>x = x + y</code></p>\n", | ||
" </details>\n", | ||
"</details>\n", | ||
"\n", | ||
|
@@ -784,7 +784,7 @@ | |
"id": "a1bf056f-3a65-4f3a-b001-2c13fc1dc1bf", | ||
"metadata": {}, | ||
"source": [ | ||
"Das liegt daran, dass ein `elif` Codeblock nur geprüft und allenfalls ausgeführt wird, wenn die vorherige Bedingung falsch war resp. die vorherigen Bedingungen falsch waren. " | ||
"Das liegt daran, dass ein `elif` Codeblock nur geprüft und allenfalls ausgeführt wird, wenn die vorherige Bedingung falsch war resp. alle vorherigen Bedingungen falsch waren. " | ||
] | ||
}, | ||
{ | ||
|
@@ -891,9 +891,9 @@ | |
"# ohne List Comprehension\n", | ||
"staenderaetinnen = []\n", | ||
"\n", | ||
"for frau in politikerinnen:\n", | ||
" if \"SR\" in frau:\n", | ||
" staenderaetinnen.append(frau)\n", | ||
"for politikerin in politikerinnen:\n", | ||
" if \"SR\" in politikerin:\n", | ||
" staenderaetinnen.append(politikerin)\n", | ||
" \n", | ||
"print(staenderaetinnen)" | ||
] | ||
|
@@ -906,7 +906,7 @@ | |
"outputs": [], | ||
"source": [ | ||
"# mit List Comprehension\n", | ||
"staenderaetinnen = [frau for frau in politikerinnen if \"SR\" in frau]\n", | ||
"staenderaetinnen = [politikerin for politikerin in politikerinnen if \"SR_\" in politikerin]\n", | ||
"\n", | ||
"print(staenderaetinnen)" | ||
] | ||
|
@@ -928,13 +928,13 @@ | |
"\n", | ||
"\n", | ||
"```python\n", | ||
"neue_liste = [expression for item in iterable if condition == True]\n", | ||
"neue_liste = [expression for item in iterable if condition]\n", | ||
"```\n", | ||
"\n", | ||
"Es werden also nur diejenigen Elemente in die neue Liste übernommen, die die Bedingung \n", | ||
"\n", | ||
"```python\n", | ||
"if condition == True\n", | ||
"if condition\n", | ||
"```\n", | ||
"\n", | ||
"erfüllen. Der erste Teil mit `expression` erlaubt es, weitere Manipulationen an denjenigen Elementen durchzuführen, die in die neue Liste übernommen wurden. \n", | ||
|
@@ -943,7 +943,7 @@ | |
"Wenn keine weitere Manipulation nötig ist (wie im Beispiel oben), dann wird einfach nochmals `item` eingefügt, also z.B.\n", | ||
"\n", | ||
"```python\n", | ||
"[frau for frau in politikerinnen if \"SR\" in frau]\n", | ||
"[politikerin for politikerin in politikerinnen if \"SR\" in politikerin]\n", | ||
"```" | ||
] | ||
}, | ||
|
@@ -998,7 +998,7 @@ | |
"\n", | ||
"<details>\n", | ||
"<summary>Tipp</summary>\n", | ||
" <p>Nutze dazu dein Wissen über Mehrfachauswahl mit dem Konstrukt <code>[:]</code>, welches auch bei einem String funktioniert, um nur Teile eines Strings auszuwählen. Dieses Konstrukt kann innerhalb der Expression angewandt werden.</p>\n", | ||
" <p>Nutze dazu dein Wissen über Mehrfachauswahl mit dem Konstrukt <code>[a:b]</code>, welches auch bei einem String funktioniert, um nur Teile eines Strings auszuwählen. Dieses Konstrukt kann innerhalb der Expression angewandt werden.</p>\n", | ||
"</details>\n", | ||
"</div>" | ||
] | ||
|
@@ -1110,7 +1110,9 @@ | |
"\n", | ||
"<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\"><img alt=\"Creative Commons Lizenzvertrag\" style=\"border-width:0\" src=\"https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg\" /></a><br />Dieses Werk ist lizenziert unter einer <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\">Creative Commons Namensnennung - Weitergabe unter gleichen Bedingungen 4.0 International Lizenz</a>.\n", | ||
"\n", | ||
"Autoren: [Noe Thalheim](mailto:[email protected]), [Benedikt Hitz-Gamper](mailto:[email protected])\n", | ||
"\n", | ||
"Autoren: [Lionel Stürmer](mailto:[email protected]) <br>\n", | ||
"Ursprünglicher Text von: [Noe Thalheim](mailto:[email protected]), [Benedikt Hitz-Gamper](mailto:[email protected])\n", | ||
"\n", | ||
"\n", | ||
"```\n", | ||
|
@@ -1122,7 +1124,7 @@ | |
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"display_name": "GraphVis--oE0K6n0", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
|
@@ -1136,15 +1138,10 @@ | |
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
"version": "3.12.3" | ||
}, | ||
"toc-autonumbering": true, | ||
"toc-showcode": true, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e" | ||
} | ||
} | ||
"toc-showcode": true | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -486,7 +486,9 @@ | |
"\n", | ||
"<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\"><img alt=\"Creative Commons Lizenzvertrag\" style=\"border-width:0\" src=\"https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg\" /></a><br />Dieses Werk ist lizenziert unter einer <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/4.0/\">Creative Commons Namensnennung - Weitergabe unter gleichen Bedingungen 4.0 International Lizenz</a>.\n", | ||
"\n", | ||
"Autoren: [Noe Thalheim](mailto:[email protected]), [Benedikt Hitz-Gamper](mailto:[email protected])\n", | ||
"\n", | ||
"Autoren: [Lionel Stürmer](mailto:[email protected]) <br>\n", | ||
"Ursprünglicher Text von: [Noe Thalheim](mailto:[email protected]), [Benedikt Hitz-Gamper](mailto:[email protected])\n", | ||
"\n", | ||
"\n", | ||
"```\n", | ||
|
@@ -498,7 +500,7 @@ | |
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"display_name": "GraphVis--oE0K6n0", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
|
@@ -512,14 +514,9 @@ | |
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
"version": "3.12.3" | ||
}, | ||
"toc-autonumbering": true, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e" | ||
} | ||
} | ||
"toc-autonumbering": true | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
|
Oops, something went wrong.