Skip to content

Commit fa93515

Browse files
authored
Create functions_niyazi_cetinkaya.py
1 parent fdb4de0 commit fa93515

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
Calculate the result of the equation: (x**a + y**b) / c.
6+
7+
:param x: positional-only integer, default is 0
8+
:param y: positional-only integer, default is 0
9+
:param a: positional-or-keyword integer, default is 1
10+
:param b: positional-or-keyword integer, default is 1
11+
:param c: keyword-only integer, default is 1
12+
:return: float result of the equation
13+
"""
14+
return (x**a + y**b) / c
15+
16+
def fn_w_counter():
17+
"""
18+
A function that tracks and counts the number of calls,
19+
and records the caller's information.
20+
21+
:return: Tuple containing total number of calls and a dictionary
22+
with the caller's __name__ as key and the count of calls as value.
23+
"""
24+
if not hasattr(fn_w_counter, "call_count"):
25+
fn_w_counter.call_count = 0
26+
fn_w_counter.callers = {}
27+
28+
fn_w_counter.call_count += 1
29+
caller_name = __name__
30+
31+
if caller_name in fn_w_counter.callers:
32+
fn_w_counter.callers[caller_name] += 1
33+
else:
34+
fn_w_counter.callers[caller_name] = 1
35+
36+
return fn_w_counter.call_count, fn_w_counter.callers

0 commit comments

Comments
 (0)