2 files modified
3 files added
| | |
| | | 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) |
| | |
| | | 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) |
New file |
| | |
| | | # 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. |
| | | |
| | | |
| | | |
New file |
| | |
| | | #Name; ECTS; Veranstaltung pro Woche |
| | | Programmierung 2; 5; 2 |
| | | Mathematik 2; 5; 3 |
New file |
| | |
| | | #! /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) |
| | | |
| | | |
| | |
| | | #! /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) |
| | |
| | | |
| | | relative_frequency = tuple( |
| | | (absolute_frequency[idx][0], absolute_frequency[idx][1] / experiments) for idx in range(1, 6 + 1) |
| | | ) |
| | | ) |