From 16c9c31c0dda091c83988e2ec260a5ce28c86ec6 Mon Sep 17 00:00:00 2001 From: busedemirbass Date: Tue, 24 Mar 2026 20:46:58 +0300 Subject: [PATCH] Create functions_buse_demirbas.py --- Week04/functions_buse_demirbas.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Week04/functions_buse_demirbas.py diff --git a/Week04/functions_buse_demirbas.py b/Week04/functions_buse_demirbas.py new file mode 100644 index 00000000..c7fe7a62 --- /dev/null +++ b/Week04/functions_buse_demirbas.py @@ -0,0 +1,27 @@ +import os + +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: + """ + Returns (x**a + y**b) / c. + + :param x: Base for the first term. + :param y: Base for the second term. + :param a: Exponent for x. + :param b: Exponent for y. + :param c: Divisor. + :return: Result as float. + """ + if not isinstance(x, int) or not isinstance(y, int) or not isinstance(c, int): + raise TypeError("x, y and c must be integers") + return (x ** a + y ** b) / c + + +_name = os.path.splitext(os.path.basename(__file__))[0] +_count = [0] + +def fn_w_counter() -> (int, dict[str, int]): + _count[0] += 1 + return (_count[0], {_name: _count[0]})