5 files modified
9 files added
New file |
| | |
| | | class Base: |
| | | def __init__(self, a, b): |
| | | self.a = a |
| | | self.b = b |
| | | |
| | | def sum(self): |
| | | return self.a + self.b |
| | | |
| | | def diff(self): |
| | | return self.a - self.b |
| | | |
| | | |
| | | class Derivate(Base): |
| | | def product(self): |
| | | return self.a * self.b |
| | | |
| | | class Derivate2(Base): |
| | | def __init__(self, a, b , c): |
| | | super().__init__(a, b) |
| | | self.c = c |
| | | |
| | | def quote(self): |
| | | return self.a / self.c |
| | | |
| | | |
| | | class Common: |
| | | def __init__(self, a, b): |
| | | self.a, self.b = a,b |
| | | def sum(self): |
| | | return self.a + self.b |
| | | |
| | | def makeMath(x:Base): |
| | | s = x.sum() |
| | | print(s) |
| | | |
| | | t = Common(8,9) |
| | | makeMath(t) |
| | | |
| | | x:Base = Base(1, 3) |
| | | makeMath(x) |
| | | |
| | | y:Derivate = Derivate(3, 4) |
| | | makeMath(y) |
| | | |
| | | z:Derivate2 = Derivate2(1, 2, 3) |
| | | makeMath(y) |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>Vorlesung</title> |
| | | </head> |
| | | <body> |
| | | |
| | | <table> |
| | | <tr> |
| | | <td>Mathematik</td> |
| | | <td>2.5</td> |
| | | <td>5</td> |
| | | </tr> |
| | | <tr> |
| | | <td>Prog 2</td> |
| | | <td>2.0</td> |
| | | <td>5</td> |
| | | </tr> |
| | | <tr> |
| | | <td>Informatik 2</td> |
| | | <td>2.0</td> |
| | | <td>5</td> |
| | | </tr> |
| | | </table> |
| | | |
| | | </body> |
| | | </html> |
| | |
| | | where = ["src"] |
| | | |
| | | [project.scripts] |
| | | mystudy = "mystudy.main:main" |
| | | mystudy = "mystudy.main:start" |
| | | |
New file |
| | |
| | | class DataFormatError(Exception): |
| | | def __init__(self): |
| | | super().__init__() |
| | | pass |
| | |
| | | from typing import Final |
| | | |
| | | from mystudy.DataFormatError import DataFormatError |
| | | |
| | | lecture_time: Final[int] = 15 |
| | | ects_effort: Final[int] = 30 |
| | | |
| | |
| | | effort_per_week = effort_in_time / duration |
| | | return effort_per_week - (self._frequency * 1.5) |
| | | |
| | | def name(self): |
| | | return self._name |
| | | |
| | | def ects(self): |
| | | return self._ects |
| | | |
| | | def frequency(self): |
| | | return self._frequency |
| | | |
| | | def __repr__(self): |
| | | return f"Vorlesungsname {self._name} ECTS: {self._ects}" |
| | | return f"Vorlesungsname {self._name} ECTS: {self._ects} Zeit/Woche {self.cal_effort()}" |
| | | |
| | | # def __str__(self): |
| | | # return self.__repr__() |
| | |
| | | count = float(words[1]) |
| | | ects = int(words[2]) |
| | | return Lecture(name, ects, count) |
| | | |
| | | pass |
| | | |
| | | |
| | | class Lecture2HTMLConverter: |
| | | def __init__(self): |
| | | self.__head = """<!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>Vorlesung</title> |
| | | </head> |
| | | <body>""" |
| | | self.__foot = """ |
| | | </body> |
| | | </html> |
| | | """ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | def to_html(self, lectures: list[Lecture]) -> str: |
| | | html = "" |
| | | for l in lectures: |
| | | html += f"""<tr> |
| | | <td>{l.name()}<td> |
| | | <td>{l.ects()}</td> |
| | | <td>{l.frequency()}</td> |
| | | <td>{l.cal_effort()}</td> |
| | | </tr>""" |
| | | return f"{self.__head}<table>{html}</table>{self.__foot}" |
| | |
| | | from mystudy.lecture import Lecture, parse_lecture_line |
| | | from mystudy.lecture import Lecture, parse_lecture_line, Lecture2HTMLConverter |
| | | from sys import argv |
| | | |
| | | |
| | | def read_file_to_lecture(filename: str) -> list[Lecture]: |
| | | lectures = [] |
| | | count_line = 0 |
| | | try: |
| | | with open(filename, 'r') as file: |
| | | while line := file.readline(): |
| | | count_line += 1 |
| | | if len(line.strip()) > 0: |
| | | l = parse_lecture_line(line) |
| | | lectures.append(l) |
| | | return lectures |
| | | except (IndexError, ValueError): |
| | | print(f"[{count_line}] Dateiformat fehlerbehaftet") |
| | | |
| | | |
| | | def main(): |
| | | def start(): |
| | | try: |
| | | filename = argv[1] |
| | | print(filename) |
| | | lectures = read_file_to_lecture(filename) |
| | | for l in lectures: |
| | | print(l) |
| | | |
| | | if lectures is not None: |
| | | converter = Lecture2HTMLConverter() |
| | | html_code = converter.to_html(lectures) |
| | | print(html_code) |
| | | except FileNotFoundError: |
| | | print(f"Datei '{filename}' nicht gefunden") |
| | |
| | | Mathematik; 2.5; 5 |
| | | Prog-2 ; 2 ; 5 |
| | | |
| | | Prog-2 ; 2.0; 5 |
| | | Informatik 2; 2; 5 |
New file |
| | |
| | | [build-system] |
| | | requires = ["setuptools"] |
| | | build-backend = "setuptools.build_meta" |
| | | |
| | | [project] |
| | | name = "turtle-geo" |
| | | version = "0.0.1" |
| | | |
| | | [tool.setuptools.packages.find] |
| | | # All the following settings are optional: |
| | | where = ["src"] |
| | | |
| | | [project.scripts] |
| | | ttgeo = "turtlegeo.main:main" |
| | | |
New file |
| | |
| | | from turtle import Turtle |
| | | |
| | | |
| | | class TtGeo(Turtle): |
| | | |
| | | def triangle(self, length, x, y): |
| | | self.teleport(x, y) |
| | | head = self.heading() |
| | | self.setheading(0) |
| | | self.forward(length) |
| | | self.left(120) |
| | | self.forward(length) |
| | | self.left(120) |
| | | self.forward(length) |
| | | self.setheading(head) |
| | | pass |
| | | |
| | | pass |
New file |
| | |
| | | from turtle import Turtle |
| | | from random import random |
| | | |
| | | from turtlegeo.TtGeo import TtGeo |
| | | |
| | | |
| | | def main(): |
| | | t = TtGeo() |
| | | t.triangle(50, 20, 25) |
| | | t.circle(50) |
| | | t.dot(25) |
| | | t.screen.mainloop() |
New file |
| | |
| | | class BaseClass: |
| | | def __init__(self, a, b): |
| | | self.a = a |
| | | self.b = b |
| | | |
| | | def sumOf(self): |
| | | return self.a + self.b |
| | | |
| | | |
| | | class ExtendClass(BaseClass): |
| | | def diffOf(self): |
| | | return self.a - self.b |
| | | |
| | | |
| | | x = BaseClass(10, 9) |
| | | s = x.sumOf() |
| | | print(s) |
| | | |
| | | y = ExtendClass(12, 4) |
| | | sy = y.sumOf() |
| | | dy = y.diffOf() |
| | | print(sy, dy) |
| | | |
| | | |
| | | |
| | | |