From 9879363a9e020c6a3c390852a986adb8d9cf7284 Mon Sep 17 00:00:00 2001
From: Hong-Phuc Bui <hong-phuc.bui@htwsaar.de>
Date: Wed, 15 May 2024 11:42:20 +0200
Subject: [PATCH] Template 4 Students OK

---
 funktion-modular/study-effort/effort_semester.py |   53 ++++++++++++++++++++++++++
 funktion-modular/study-effort/Vorlesungen.txt    |    3 +
 python-grundlage/dice-simulation.py              |    5 +-
 funktion-modular/calendar/month_of_year.py       |    4 +-
 funktion-modular/study-effort/README.md          |   42 +++++++++++++++++++++
 5 files changed, 103 insertions(+), 4 deletions(-)

diff --git a/funktion-modular/calendar/month_of_year.py b/funktion-modular/calendar/month_of_year.py
index 03c7110..2d28dfa 100755
--- a/funktion-modular/calendar/month_of_year.py
+++ b/funktion-modular/calendar/month_of_year.py
@@ -67,7 +67,7 @@
     diff = (7 + day_of_first_date - first_day_of_week) % 7
     # -> empty column
     for _ in range(diff, 0, -1):
-        month_view += ("#"*(column_width - 1) + "-")
+        month_view += ("-" + "#"*(column_width - 1) )
     # -> next days in the first week
     while day + diff <= 7:
         month_view += format_day(day, column_width)
@@ -97,5 +97,5 @@
 if __name__ == "__main__":
     month = int(sys.argv[1])
     year = int(sys.argv[2])
-    cal = build_calendar(month, year, 4)
+    cal = build_calendar(month, year, 5)
     print(cal)
\ No newline at end of file
diff --git a/funktion-modular/study-effort/README.md b/funktion-modular/study-effort/README.md
new file mode 100644
index 0000000..cbb8720
--- /dev/null
+++ b/funktion-modular/study-effort/README.md
@@ -0,0 +1,42 @@
+# Study Effort
+
+1. Erstellen Sie einen Ordner `study-effort` für das Projekt!
+2. In der Ordner legen Sie die Datei `Vorlesungen.txt` mit folgenden Inhalt an:
+
+```text
+#Name; ECTS; Veranstaltung pro Woche
+Programmierung 2; 5; 2
+Mathematik 2; 5; 3
+```
+
+
+3. Schreiben Sie ein Python Programm `effort_semester.py`, das wie folgt genutzt wird:
+
+```shell
+$ python3 effort_semester.py Vorlesungen.txt
+Vorlesung                  ECTS         V-Ü-T/Woche   Selbstudiumszeit pro Woche
+Programmierung 2           5            2              <>
+Mathematik 2               5            3              <>
+--------------------------------------------------------------------------------
+                                                       <>
+```
+
+Die Platzhalter `<>` sollen mit richtigen Werten ersetzt werden.
+
+
+Sie können folgenden Funktionen benutzen:
+
+* String Verarbeitung
+    * `str.ljust()`
+    * `str.rjust()`
+* Datei-Handling
+    * `open()`
+
+
+Sie sollen das Programm nach Semantik in Funktionen aufteilen.
+
+Ergänzen Sie die Datei `Vorlesungen.txt` mit weiteren Vorlesungen und testen Sie das Programm, 
+ob es noch korrekt funktioniert.
+
+
+
diff --git a/funktion-modular/study-effort/Vorlesungen.txt b/funktion-modular/study-effort/Vorlesungen.txt
new file mode 100644
index 0000000..dd7a3aa
--- /dev/null
+++ b/funktion-modular/study-effort/Vorlesungen.txt
@@ -0,0 +1,3 @@
+#Name; ECTS; Veranstaltung pro Woche
+Programmierung 2; 5; 2
+Mathematik 2; 5; 3
diff --git a/funktion-modular/study-effort/effort_semester.py b/funktion-modular/study-effort/effort_semester.py
new file mode 100644
index 0000000..33a90fc
--- /dev/null
+++ b/funktion-modular/study-effort/effort_semester.py
@@ -0,0 +1,53 @@
+#! /usr/bin/evn python
+
+"""
+Programm zum Berechnen den Aufwand für das Selbststudium pro Woche in einem Semester.
+
+Das Semester hat 15 Woche.
+Eine Doppelstunde (DS) entspricht 90 Minuten. Ein ECTS entspricht einen Aufwand von 30 Stunden.
+Eine Veranstaltung (Vorlesung, Übung, Tutorium) ist 2 DS.
+Die Vorlesungen in einem Semester werden in einer Text-Datei erfasst. Ein Template ist wie folgt:
+
+```txt
+#Name; ECTS; Veranstaltung pro Woche
+Programmierung 2; 5; 2
+Mathematik 2; 5; 3
+```
+
+Usage:
+
+$python effort_semester.py Vorlesungen.txt
+                 Vorlesung ECTS         V-Ü-T/Woche   Selbstudiumszeit pro Woche
+          Programmierung 2 5            2              <>
+              Mathematik 2 5            3              <>
+--------------------------------------------------------------------------------
+                                                       <>
+"""
+import sys
+from typing import Final
+
+SEMESTER_LENGTH: Final[int] = 15  # 15 Woche pro Semester
+
+
+def collect_lectures_from_file(lecture_filename:str) -> list[tuple[str, float, float]]:
+    # Your code here
+    pass
+
+
+def compute_semester_effort(lectures: list[tuple[str, float, float]]) -> list[tuple[str, float, float, float]]:
+    # Your code here
+    pass
+
+
+def print_effort(effort: list[tuple[str, float, float, float]]) -> None:
+    # Your code here
+    pass
+
+
+if __name__ == "__main__":
+    lecture_filename = sys.argv[1]
+    lectures = collect_lectures_from_file(lecture_filename)
+    effort = compute_semester_effort(lectures)
+    print_effort(effort)
+
+
diff --git a/python-grundlage/dice-simulation.py b/python-grundlage/dice-simulation.py
index 78fc39a..772a26d 100644
--- a/python-grundlage/dice-simulation.py
+++ b/python-grundlage/dice-simulation.py
@@ -1,8 +1,9 @@
 #! /usr/bin/evn python
 import random
+from typing import Final
 
 random.seed(5643)
-experiments = 500
+experiments: Final[int] = 500
 dice_roll = tuple(random.randint(1, 6) for r in range(0, experiments))
 absolute_frequency = tuple((face, len([f for f in dice_roll if f == face]))
                            for face in range(1, 6 + 1)
@@ -16,4 +17,4 @@
 
 relative_frequency = tuple(
     (absolute_frequency[idx][0], absolute_frequency[idx][1] / experiments) for idx in range(1, 6 + 1)
-)
\ No newline at end of file
+)

--
Gitblit v1.10.0-SNAPSHOT