Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to python notebook #416

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions python/python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"- Aktuelle Version: Python 3.12\n",
"- *Interpretierte* Programmiersprache\n",
" - Kein Kompilieren\n",
" - In der Standardversion `cpython`: kein Kompilieren zu Maschinencode, [sondern zu Bytecode](https://github.com/python/cpython/blob/main/InternalDocs/compiler.md)\n",
" - Programme werden mit dem `python`-Programm ausgeführt\n",
"- Eignet sich sehr gut zum Erlernen der Programmierung!\n",
"- Viele nützliche Pakete, die das wissenschaftliche Arbeiten extrem erleichtern!\n",
Expand Down Expand Up @@ -2219,9 +2219,10 @@
"T = [0.25, 0.5, 0.75, 1.0, 1.25, 1.5]\n",
"\n",
"# ohne Schleife\n",
"data = {\"t\":T, \"h\": [h(T[0]),h(T[1]),h(T[2]),h(T[3]),h(T[4]),h(T[5])],\n",
" \"v\": [v(T[0]),v(T[1]),v(T[2]),v(T[3]),v(T[4]),v(T[5])],\n",
" \"a\": [a(T[0]),a(T[1]),a(T[2]),a(T[3]),a(T[4]),a(T[5])]}\n",
"data = {\"t\":T,\n",
" \"h\": [h(T[0]), h(T[1]), h(T[2]), h(T[3]), h(T[4]), h(T[5])],\n",
" \"v\": [v(T[0]), v(T[1]), v(T[2]), v(T[3]), v(T[4]), v(T[5])],\n",
" \"a\": [a(T[0]), a(T[1]), a(T[2]), a(T[3]), a(T[4]), a(T[5])]}\n",
"\n",
"print(data)\n",
"\n",
Expand Down Expand Up @@ -2255,6 +2256,12 @@
"\n",
"for k,v in data.items():\n",
" print(f\"{k} {v[0]:6.2f} {v[1]:6.2f} {v[2]:6.2f} {v[3]:6.2f} {v[4]:6.2f} {v[5]:6.2f}\")\n",
"\n",
"# Noch eine Schleife (List-Comprehension) mehr, erübrigt die Wiederholungen\n",
"\n",
"for key, values in data.items():\n",
" formatted_values = \" \".join([f\"{v:6.2f}\" for v in values])\n",
" print(f\"{key} {formatted_values}\")\n",
"```\n",
"\n",
"</details>\n"
Expand Down
Loading