Skip to content

Commit 18148c3

Browse files
authored
Merge pull request #68 from yavuzserdogan/patch-2
Create functions_yavuz_selim.py
2 parents 3574fa1 + 8e092a7 commit 18148c3

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Week03/functions_yavuz_selim.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
:param c: A constant term in the equation, default is 1
15+
:type c: int
16+
:return : The result of the equation with the given values
17+
:rtype: int
18+
"""
19+
return (x**a + y**b)/c
20+
21+
def fn_w_counter() -> (int, dict[str, int]):
22+
if not hasattr(fn_w_counter, "call_count"):
23+
fn_w_counter.call_count = 0
24+
fn_w_counter._dict = {}
25+
caller_name = __name__
26+
fn_w_counter.call_count += 1
27+
if caller_name in fn_w_counter._dict:
28+
fn_w_counter._dict[caller_name] += 1
29+
else:
30+
fn_w_counter._dict[caller_name] = 1
31+
return fn_w_counter.call_count, fn_w_counter._dict

0 commit comments

Comments
 (0)