Skip to content

Commit 9a80128

Browse files
authored
functions_melisa_sahin.py
1 parent 7b3a853 commit 9a80128

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Week03/functions_melisa_sahin.py

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+
4+
def custom_equation(x=0, y=0, /, a=1, b=1, *, c=1) -> float:
5+
"""
6+
This function adds the b power of the y variable to the a power of the x variable. Divides the result by variable c.
7+
8+
:param x: First base number, default is 0
9+
:param y: Second base number, default is 0
10+
:param a: First exponent number, default is 1
11+
:param b: Second exponent number, default is 1
12+
:param c: Division number, default is 1
13+
:return: Returns the result of the equation as a float
14+
:rtype: float
15+
16+
"""
17+
return (x**a + y**b) / c
18+
19+
20+
def fn_w_counter():
21+
if not hasattr(fn_w_counter, "counter"):
22+
fn_w_counter.counter = 0
23+
fn_w_counter.caller_info = {}
24+
25+
caller_name = __name__
26+
fn_w_counter.counter += 1
27+
28+
if caller_name in fn_w_counter.caller_info:
29+
fn_w_counter.caller_info[caller_name] += 1
30+
else:
31+
fn_w_counter.caller_info[caller_name] = 1
32+
33+
return (fn_w_counter.counter, fn_w_counter.caller_info)
34+
35+
36+

0 commit comments

Comments
 (0)