From 52e0d8a3e8b583ae9b4680637c3490d94fb65d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20alp=20=C3=96zdemir?= <109877223+akoalp@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:23:12 +0300 Subject: [PATCH 1/2] Create functions_alp_ozdemir.py --- Week04/functions_alp_ozdemir.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Week04/functions_alp_ozdemir.py diff --git a/Week04/functions_alp_ozdemir.py b/Week04/functions_alp_ozdemir.py new file mode 100644 index 00000000..f80f48d9 --- /dev/null +++ b/Week04/functions_alp_ozdemir.py @@ -0,0 +1,24 @@ +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 the mathematical equation. + + :param x: The first base value. + :param y: The second base value. + :param a: The exponent for x. + :param b: The exponent for y. + :param c: The divisor. + :return: The result of the equation. + """ + + res = float((x ** a + y**b) / c) + return res + +_call_counter = 0 + +def fn_w_counter() -> (int,dict[str,int]): + global _call_counter + _call_counter += 1 + return _call_counter,{__name__:_call_counter} From 86797c06af5ed8103196c112688f492d995bc5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20alp=20=C3=96zdemir?= <109877223+akoalp@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:23:03 +0300 Subject: [PATCH 2/2] Update functions_alp_ozdemir.py --- Week04/functions_alp_ozdemir.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Week04/functions_alp_ozdemir.py b/Week04/functions_alp_ozdemir.py index f80f48d9..4b18359d 100644 --- a/Week04/functions_alp_ozdemir.py +++ b/Week04/functions_alp_ozdemir.py @@ -16,9 +16,9 @@ def custom_equation(x : int = 0,y : int = 0,/,a : int = 1,b: int = 1,*,c: int = res = float((x ** a + y**b) / c) return res -_call_counter = 0 - def fn_w_counter() -> (int,dict[str,int]): - global _call_counter - _call_counter += 1 - return _call_counter,{__name__:_call_counter} + if not hasattr(fn_w_counter, "counter"): + fn_w_counter.counter = 0 + fn_w_counter.counter += 1 + return fn_w_counter.counter, {__name__: fn_w_counter.counter} +