Skip to content

Commit c01dbef

Browse files
authored
Create functions_ece_akinci.py
1 parent 55dd2ec commit c01dbef

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Week04/functions_ece_akinci.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
custom_power = lambda x=0, /, e=1: x ** e
2+
3+
4+
def custom_equation(x:int=0, y:int=0 , / ,a:int=1,b:int=1,*,c:int=1) -> float:
5+
"""
6+
:param x: Positional-only base value for the first term; defaults to 0.
7+
:param y: Positional-only base value for the second term; defaults to 0.
8+
:param a: Exponent for `x`, can be used as positional or keyword; defaults to 1.
9+
:param b: Exponent for `y`, can be used as positional or keyword; defaults to 1.
10+
:param c: Keyword-only divisor for the result; defaults to 1.
11+
:return: The result of the equation `(x**a + y**b) / c`.
12+
:rtype: float.
13+
"""
14+
return (x**a + y**b) / c
15+
16+
17+
def fn_w_counter() -> (int, dict[str, int]):
18+
if not hasattr(fn_w_counter, "call_count"):
19+
fn_w_counter.call_count = 0
20+
fn_w_counter._dict = {}
21+
caller_name = __name__
22+
fn_w_counter.call_count += 1
23+
if caller_name in fn_w_counter._dict:
24+
fn_w_counter._dict[caller_name] += 1
25+
else:
26+
fn_w_counter._dict[caller_name] = 1
27+
return fn_w_counter.call_count, fn_w_counter._dict

0 commit comments

Comments
 (0)