From b366f5907ce0f3354b465eb1e5841f450e9f7e8c Mon Sep 17 00:00:00 2001 From: Franziska Gerold Date: Fri, 20 Feb 2026 16:41:58 +0100 Subject: [PATCH 1/3] feat: add addition function and its test-function --- .pre-commit-config.yaml | 18 ++++++++++++++++++ src/__init__.py | 0 src/moduleA.py | 10 ++++++++++ tests/test_moduleA.py | 6 ++++++ 4 files changed, 34 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 src/__init__.py create mode 100644 src/moduleA.py create mode 100644 tests/test_moduleA.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a00cee1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.0 + hooks: + - id: ruff # Linting + + - repo: https://github.com/psf/black + rev: stable + hooks: + - id: black # formatting diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/moduleA.py b/src/moduleA.py new file mode 100644 index 0000000..b7f0906 --- /dev/null +++ b/src/moduleA.py @@ -0,0 +1,10 @@ +def addition(a=1, b=2): + return a + b + + +def f(x: int, y: int) -> int: + return x + y + + +if __name__ == "__main__": + print(addition(5, 5)) diff --git a/tests/test_moduleA.py b/tests/test_moduleA.py new file mode 100644 index 0000000..42fe6cc --- /dev/null +++ b/tests/test_moduleA.py @@ -0,0 +1,6 @@ +from src.moduleA import addition + + +def test_a(): + assert addition() == 3 + assert addition(5, 5) == 10 From 2ffebe9db4049aebb69ae38e25a39710ee53efac Mon Sep 17 00:00:00 2001 From: Franziska Gerold Date: Fri, 27 Feb 2026 14:28:17 +0100 Subject: [PATCH 2/3] new file: kata solution 'mean square error' --- src/kata_mean_square_error.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/kata_mean_square_error.py diff --git a/src/kata_mean_square_error.py b/src/kata_mean_square_error.py new file mode 100644 index 0000000..fa179f6 --- /dev/null +++ b/src/kata_mean_square_error.py @@ -0,0 +1,13 @@ +""" +Lösung des Katas: Mean Square Error von kylehill +Link zum Kata: https://www.codewars.com/kata/51edd51599a189fe7f000015 + +""" + + +def solution(array_a, array_b): + numbers_list = list(zip(array_a, array_b)) + differences = [x[0] - x[1] for x in numbers_list] + mean_square_error = sum([x * x for x in differences]) / len(differences) + + return mean_square_error From 444b5dabbd3d5e21c918ef87182d38d0ae8ce84e Mon Sep 17 00:00:00 2001 From: Franziska Gerold Date: Fri, 6 Mar 2026 13:30:46 +0100 Subject: [PATCH 3/3] =?UTF-8?q?new=20file:=20L=C3=B6sung=20Kata=20Caesar?= =?UTF-8?q?=20Cipher=20Helper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/caesar_cipher_helper | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/caesar_cipher_helper diff --git a/src/caesar_cipher_helper b/src/caesar_cipher_helper new file mode 100644 index 0000000..2ba5dfb --- /dev/null +++ b/src/caesar_cipher_helper @@ -0,0 +1,39 @@ +""" +Lösung des Katas: Caesar Cipher Helper +Link: https://www.codewars.com/kata/526d42b6526963598d0004db +""" + + +beginning_alphabet = ord("A") +ending_alphabet = ord("Z") + +class CaesarCipher(object): + def __init__(self, offset): + self.offset = offset + + def encode(self, st): + upper = st.upper() + encoded_st = "" + for char in upper: + if beginning_alphabet <= ord(char) <= ending_alphabet: + encoded_char = (ord(char) + self.offset) + if encoded_char > ending_alphabet: + encoded_char -= (ending_alphabet - (beginning_alphabet - 1)) + encoded_st += chr(encoded_char) + else: + encoded_st += char + + return encoded_st + + def decode(self, st): + decoded_st = "" + for char in st: + if beginning_alphabet <= ord(char) <= ending_alphabet: + decoded_char = (ord(char) - self.offset) + if decoded_char < beginning_alphabet: + decoded_char += (ending_alphabet - (beginning_alphabet - 1)) + decoded_st += chr(decoded_char) + else: + decoded_st += char + + return decoded_st