Skip to content

Commit 03da85b

Browse files
authored
Create functions_ege_enc.py
1 parent 71f5b39 commit 03da85b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Week04/functions_ege_enc.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(x: int = 0, y: int = 0, /, a: int = 1, b: int = 1, *, c: int = 1) -> float:
4+
"""
5+
Calculates the result based on the provided formula.
6+
7+
:param x: The positional-only integer base parameter, default is 0
8+
:param y: The positional-only integer base parameter, default is 0
9+
:param a: The positional-or-keyword integer exponent parameter, default is 1
10+
:param b: The positional-or-keyword integer exponent parameter, default is 1
11+
:param c: The keyword-only integer divisor parameter, default is 1
12+
:return: The result of (x**a + y**b)/c as a float
13+
:rtype: float
14+
"""
15+
return float((x**a + y**b) / c)
16+
17+
def fn_w_counter() -> tuple:
18+
if not hasattr(fn_w_counter, 'call_counter'):
19+
fn_w_counter.call_counter = 0
20+
fn_w_counter.caller_stats = {}
21+
22+
caller_name = __name__
23+
24+
fn_w_counter.call_counter += 1
25+
26+
if caller_name in fn_w_counter.caller_stats:
27+
fn_w_counter.caller_stats[caller_name] += 1
28+
else:
29+
fn_w_counter.caller_stats[caller_name] = 1
30+
31+
return fn_w_counter.call_counter, fn_w_counter.caller_stats

0 commit comments

Comments
 (0)