Skip to content

Commit b0b6923

Browse files
authored
Merge pull request #98 from sahinmelisa/patch-3
functions_melisa_sahin.py
2 parents a510762 + 3f208b4 commit b0b6923

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Week03/functions_melisa_sahin.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
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+
:type x: int
10+
:param y: Second base number, default is 0
11+
:type y: int
12+
:param a: First exponent number, default is 1
13+
:type a: int
14+
:param b: Second exponent number, default is 1
15+
:type b: int
16+
:param c: Division number, default is 1
17+
:type c: int
18+
:return: Returns the result of the equation as a float
19+
:rtype: float
20+
21+
"""
22+
return float((x**a + y**b) / c)
23+
24+
25+
def fn_w_counter() -> (int, dict[str, int]):
26+
if not hasattr(fn_w_counter, "counter"):
27+
fn_w_counter.counter = 0
28+
fn_w_counter.caller_info = {}
29+
30+
caller_name = __name__
31+
fn_w_counter.counter += 1
32+
33+
if caller_name in fn_w_counter.caller_info:
34+
fn_w_counter.caller_info[caller_name] += 1
35+
else:
36+
fn_w_counter.caller_info[caller_name] = 1
37+
38+
return (fn_w_counter.counter, fn_w_counter.caller_info)
39+
40+
41+
42+
43+
44+

0 commit comments

Comments
 (0)