Skip to content

Commit 3b02c74

Browse files
Create functions_yavuz_selim.py
1 parent fe4037f commit 3b02c74

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Week03/functions_yavuz_selim.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
This funciton calculates the value of an equation given certain parameters
6+
:param x: The first number, default is 0
7+
:type x: int
8+
:param y: The second number, default is 0
9+
:type y: int
10+
:param a: The coefficient for x in the equation, default is 1
11+
:type a: int
12+
:param b: The coefficient for y in the equation, default is 1
13+
:type b: int
14+
:return : The result of the equation with the given values
15+
:rtype: int
16+
"""
17+
return (x**a + y**b)/c
18+
19+
def fn_w_counter() -> (int, dict[str, int]):
20+
if not hasattr(fn_w_counter, "call_count"):
21+
fn_w_counter.call_count = 0
22+
fn_w_counter._dict = {}
23+
caller_name = __name__
24+
fn_w_counter.call_count += 1
25+
if caller_name in fn_w_counter._dict:
26+
fn_w_counter._dict[caller_name] += 1
27+
else:
28+
fn_w_counter._dict[caller_name] = 1
29+
return fn_w_counter.call_count, fn_w_counter._dict

0 commit comments

Comments
 (0)