From 8f597e8bb5952c7c6db13409802ba7cb62617617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fevzi=20Ba=C4=9Fr=C4=B1a=C3=A7=C4=B1k?= <124450541+fevzibagriacik@users.noreply.github.com> Date: Thu, 2 Apr 2026 17:56:26 +0300 Subject: [PATCH 1/2] Implement custom power and equation functions Added custom_power lambda and custom_equation function for calculations, along with fn_w_counter for tracking function calls. --- Week04/functions_fevzi_bagriacik.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Week04/functions_fevzi_bagriacik.py diff --git a/Week04/functions_fevzi_bagriacik.py b/Week04/functions_fevzi_bagriacik.py new file mode 100644 index 00000000..ab9f490c --- /dev/null +++ b/Week04/functions_fevzi_bagriacik.py @@ -0,0 +1,31 @@ +custom_power = lambda x=0, /, e=1 : x ** e + +def custom_equation(x=0, y=0, /, a=1, b=1, *, c=1) -> float: + """ + This function calculates (x ** a + y ** b) / c + + :param arg1: First number (positional-only). Default to 0. + :param arg2: Second number (positional-only). Default to 0. + :param arg3: Third number (positional or keyword). Default to 1. + :param arg4: Fourth number (positional or keyword). Default to 1. + :param arg5: Fifth number (keyword-only). Default to 1. + :return: (x ** a + y ** b) / c. + """ + + return (x ** a + y ** b) / c + +def fn_w_counter() -> (int, dict[str, int]): + if not hasattr(fn_w_counter, 'total_count'): + fn_w_counter.total_count = 0 + fn_w_counter.caller_dict = {} + + caller_name = fn_w_counter.__module__ + + fn_w_counter.total_count += 1 + + if caller_name in fn_w_counter.caller_dict: + fn_w_counter.caller_dict[caller_name] += 1 + else: + fn_w_counter.caller_dict[caller_name] = 1 + + return fn_w_counter.total_count, fn_w_counter.caller_dict From 54bc549446b7c581e9e39d538cbb879f3705af41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fevzi=20Ba=C4=9Fr=C4=B1a=C3=A7=C4=B1k?= <124450541+fevzibagriacik@users.noreply.github.com> Date: Thu, 2 Apr 2026 17:58:44 +0300 Subject: [PATCH 2/2] Update functions_fevzi_bagriacik.py --- Week04/functions_fevzi_bagriacik.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Week04/functions_fevzi_bagriacik.py b/Week04/functions_fevzi_bagriacik.py index ab9f490c..46b79066 100644 --- a/Week04/functions_fevzi_bagriacik.py +++ b/Week04/functions_fevzi_bagriacik.py @@ -1,6 +1,6 @@ custom_power = lambda x=0, /, e=1 : x ** e -def custom_equation(x=0, y=0, /, a=1, b=1, *, c=1) -> float: +def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float: """ This function calculates (x ** a + y ** b) / c