Skip to content

Commit df18ddb

Browse files
authored
Create functions_roca_ozdaman.py
1 parent 71f5b39 commit df18ddb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Week04/functions_roca_ozdaman.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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 a custom equation.
6+
7+
:param x: Positional-only integer.
8+
:param y: Positional-only integer.
9+
:param a: Exponent for x.
10+
:param b: Exponent for y.
11+
:param c: Divisor.
12+
:return: Result of (x**a + y**b) / c
13+
"""
14+
return (x ** a + y ** b) / c
15+
16+
def fn_w_counter() -> (int, dict[str, int]):
17+
if not hasattr(fn_w_counter,'_call_counter'):
18+
fn_w_counter._call_counter = 0
19+
fn_w_counter._caller_dict = {}
20+
caller = __name__
21+
fn_w_counter._call_counter += 1
22+
if caller in fn_w_counter._caller_dict:
23+
fn_w_counter._caller_dict[caller] += 1
24+
else:
25+
fn_w_counter._caller_dict[caller] = 1
26+
return fn_w_counter._call_counter,fn_w_counter._caller_dict

0 commit comments

Comments
 (0)