From a8e9c2dc8ac05cd257b3277d66fa653290e82ce9 Mon Sep 17 00:00:00 2001 From: busedemirbass Date: Wed, 15 Apr 2026 09:47:54 +0300 Subject: [PATCH 1/2] Create functions_buse_demirbas --- Week04/functions_buse_demirbas | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Week04/functions_buse_demirbas diff --git a/Week04/functions_buse_demirbas b/Week04/functions_buse_demirbas new file mode 100644 index 00000000..0f264a4b --- /dev/null +++ b/Week04/functions_buse_demirbas @@ -0,0 +1,33 @@ +import inspect + +custom_power = lambda x=0, /, e=1: x ** e + +def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float: + """ + Calculates (x**a + y**b) / c with specific parameter constraints. + + :param x: base for the first term (positional-only) + :param y: base for the second term (positional-only) + :param a: exponent for x + :param b: exponent for y + :param c: divisor (keyword-only) + :return: result of the equation as a float + """ + if not all(isinstance(val, int) for val in [x, y, a, b, c]): + raise TypeError("Parameters must be integers") + + return float((x**a + y**b) / c) + +def fn_w_counter() -> (int, dict[str, int]): + if not hasattr(fn_w_counter, "count"): + fn_w_counter.count = 0 + fn_w_counter.callers = {} + + fn_w_counter.count += 1 + + caller_frame = inspect.currentframe().f_back + caller_name = caller_frame.f_globals.get('__name__', 'unknown') + + fn_w_counter.callers[caller_name] = fn_w_counter.callers.get(caller_name, 0) + 1 + + return fn_w_counter.count, fn_w_counter.callers From 9d47e4c83051b25f6d7e9e8f37d87921c57eb570 Mon Sep 17 00:00:00 2001 From: busedemirbass Date: Wed, 15 Apr 2026 10:01:26 +0300 Subject: [PATCH 2/2] Rename functions_buse_demirbas to functions_buse_demirbas.py --- Week04/{functions_buse_demirbas => functions_buse_demirbas.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Week04/{functions_buse_demirbas => functions_buse_demirbas.py} (100%) diff --git a/Week04/functions_buse_demirbas b/Week04/functions_buse_demirbas.py similarity index 100% rename from Week04/functions_buse_demirbas rename to Week04/functions_buse_demirbas.py