From 67eb44796cd21883f3a27b02f69e4086c6ecec3a Mon Sep 17 00:00:00 2001 From: tilo Date: Thu, 16 Oct 2025 16:51:35 +0200 Subject: [PATCH] initial project commit --- main.py | 35 +++++++++++++++++++++++++++++++++++ numeric/__init__.py | 0 requirements.txt | Bin 0 -> 96 bytes util/__init__.py | 0 util/tools.py | 21 +++++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 main.py create mode 100644 numeric/__init__.py create mode 100644 requirements.txt create mode 100644 util/__init__.py create mode 100644 util/tools.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..bd6dc2d --- /dev/null +++ b/main.py @@ -0,0 +1,35 @@ +from tabulate import tabulate + +from numeric.compute import matmul, transpose, rot_2D +from util.tools import substring + +if __name__ == '__main__': + # Substring + original = "GEEKSFORGEEKS" + # print(substring(original, 0, 5)) # Output: GEEKS + # print(substring(original, 5)) # Output: FORGEEKS + + # Matrix multiplication + matrix_a = [[3, 4, -1, 4], + [-2, 2, 5, 1] + ] + matrix_b = [[1, 3, -2], + [2, 5, 1], + [-1, 4, -4], + [2, 3, 6] + ] + matrix_c = matmul(matrix_a, matrix_b) + # print("Ergebnis C = A * B:") + + # for row in matrix_c: + # print(row) + + # Transposition + matrix = [ + [1, 2, 3], + [4, 5, 6] + ] + # print(tabulate(transpose(matrix))) + + # Rotation + print(tabulate(rot_2D(90))) diff --git a/numeric/__init__.py b/numeric/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..470d877e52d0080c8b7f51b686d0d79d37c4acbb GIT binary patch literal 96 zcmezWFP9;ap@boqp_Czq!4?P&81%r{h=G@Zi=lv_k|7 str: + """ + A substring function + :param string: The string + :param start: The starting index + :param end: The ending index. If None, this is set to the length of the substring :return: + """ + if not isinstance(string, str): + raise ValueError("No string provided") + if not isinstance(start, int): + raise ValueError("No starting index provided") + + if end is None: + end = len(str) + + result = "" + + for i in range(start, end): + result += string[i] + + return result