From 2d54330178e81d84b0c334a99f934bc701dece11 Mon Sep 17 00:00:00 2001 From: Burakhan7 <141933959+Burakhan7@users.noreply.github.com> Date: Mon, 5 Jan 2026 16:53:52 +0300 Subject: [PATCH] Create functions_burakhan_gultoplar.py --- Week04/functions_burakhan_gultoplar.py | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Week04/functions_burakhan_gultoplar.py diff --git a/Week04/functions_burakhan_gultoplar.py b/Week04/functions_burakhan_gultoplar.py new file mode 100644 index 00000000..dd942947 --- /dev/null +++ b/Week04/functions_burakhan_gultoplar.py @@ -0,0 +1,39 @@ +custom_power = lambda x=0, /, e=1: pow(x, e) + +def custom_equation( + x: int = 0, + y: int = 0, + /, + a: int = 1, + b: int = 1, + *, + c: int = 1 +) -> float: + """ + Computes a custom mathematical equation. + + :param x: positional-only integer, default 0 + :param y: positional-only integer, default 0 + :param a: multiplier for x, default 1 + :param b: multiplier for y, default 1 + :param c: divisor value, keyword-only, default 1 + :return: calculated float result + """ + + for val in (x, y, a, b, c): + if not isinstance(val, int): + raise TypeError("Parameters must be integers") + + if c == 0: + raise ZeroDivisionError("c must not be zero") + + return (a * x + b * y) / c + +_counter = 0 + +def fn_w_counter() -> (int, dict[str, int]): + global _counter + _counter += 1 + + module_name = __name__.split('.')[-1] + return _counter, {module_name: _counter}