From 1bc1bfc535bbc39b1325192ba08fe537369bc179 Mon Sep 17 00:00:00 2001 From: Tristan Schulz Date: Mon, 30 Sep 2024 20:35:59 +0200 Subject: [PATCH] Tolle Schleifen --- lecture/04_Schleifen/04_Schleifen.tex | 1 + lecture/04_Schleifen/listings/listen_for.py | 2 +- lecture/04_Schleifen/listings/listen_while.py | 2 +- lecture/04_Schleifen/listings/listen_while_output.sh | 2 +- lecture/04_Schleifen/livecoding/while1.py | 0 5 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 lecture/04_Schleifen/livecoding/while1.py diff --git a/lecture/04_Schleifen/04_Schleifen.tex b/lecture/04_Schleifen/04_Schleifen.tex index 039f5e3..3ea43cd 100644 --- a/lecture/04_Schleifen/04_Schleifen.tex +++ b/lecture/04_Schleifen/04_Schleifen.tex @@ -190,6 +190,7 @@ \subsection{Elemente Entfernen} \section{While-Schleife} \subtitle{Schleifen mit Listen} + \begin{frame}[fragile] \slidehead Wir können mit Schleifen über Listenelemente laufen und diese weiter verarbeiten diff --git a/lecture/04_Schleifen/listings/listen_for.py b/lecture/04_Schleifen/listings/listen_for.py index ac50f83..7df1842 100644 --- a/lecture/04_Schleifen/listings/listen_for.py +++ b/lecture/04_Schleifen/listings/listen_for.py @@ -1,3 +1,3 @@ tolle_liste = [5, 1, 4, 2, 3] for x in tolle_liste: - print(x, end=" | ") + print(x) diff --git a/lecture/04_Schleifen/listings/listen_while.py b/lecture/04_Schleifen/listings/listen_while.py index 20adf6a..0777af9 100644 --- a/lecture/04_Schleifen/listings/listen_while.py +++ b/lecture/04_Schleifen/listings/listen_while.py @@ -1,5 +1,5 @@ i: int = 0 tolle_liste = [5, 1, 4, 2, 3] while i < len(tolle_liste): - print(tolle_liste[i], end=" | ") + print(tolle_liste[i]) i = i + 1 diff --git a/lecture/04_Schleifen/listings/listen_while_output.sh b/lecture/04_Schleifen/listings/listen_while_output.sh index 2a4d1d4..1a00361 100644 --- a/lecture/04_Schleifen/listings/listen_while_output.sh +++ b/lecture/04_Schleifen/listings/listen_while_output.sh @@ -1 +1 @@ -5 | 1 | 4 | 2 | 3 | ⏎ +5 ⏎ 1 ⏎ 4 ⏎ 2 ⏎ 3 ⏎ diff --git a/lecture/04_Schleifen/livecoding/while1.py b/lecture/04_Schleifen/livecoding/while1.py new file mode 100644 index 0000000..e69de29