Skip to content

Commit 4b9da1d

Browse files
authored
Create functions_kayra_hokenek.py
1 parent 8cfff6e commit 4b9da1d

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎Week04/functions_kayra_hokenek.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
custom_power = lambda x=0, /, e=1: x**e
2+
3+
def custom_equation(
4+
x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float:
5+
6+
"""
7+
Function calculates (x**a + y**b) / c.
8+
9+
:param x: base value for first term (positional-only).
10+
:type x: int
11+
:param y: base value for second term (positional-only).
12+
:type y: int
13+
:param a: exponent for x (positional-or-keyword).
14+
:type a: int
15+
:param b: exponent for y (positional-or-keyword).
16+
:type b: int
17+
:param c: divisor value (keyword-only).
18+
:type c: int
19+
:return: result of (x**a + y**b) / c
20+
:rtype: float
21+
"""
22+
23+
return (x ** a + y ** b) / c
24+
25+
def fn_w_counter() -> (int, dict[str, int]):
26+
if not hasattr(fn_w_counter, "callers"):
27+
fn_w_counter.callers = {}
28+
29+
fn_w_counter.callers[__name__] = fn_w_counter.callers.get(__name__, 0) + 1
30+
31+
return sum(fn_w_counter.callers.values()), dict(fn_w_counter.callers)

0 commit comments

Comments
 (0)