Skip to content

Commit 2d54330

Browse files
authored
Create functions_burakhan_gultoplar.py
1 parent 71f5b39 commit 2d54330

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
custom_power = lambda x=0, /, e=1: pow(x, e)
2+
3+
def custom_equation(
4+
x: int = 0,
5+
y: int = 0,
6+
/,
7+
a: int = 1,
8+
b: int = 1,
9+
*,
10+
c: int = 1
11+
) -> float:
12+
"""
13+
Computes a custom mathematical equation.
14+
15+
:param x: positional-only integer, default 0
16+
:param y: positional-only integer, default 0
17+
:param a: multiplier for x, default 1
18+
:param b: multiplier for y, default 1
19+
:param c: divisor value, keyword-only, default 1
20+
:return: calculated float result
21+
"""
22+
23+
for val in (x, y, a, b, c):
24+
if not isinstance(val, int):
25+
raise TypeError("Parameters must be integers")
26+
27+
if c == 0:
28+
raise ZeroDivisionError("c must not be zero")
29+
30+
return (a * x + b * y) / c
31+
32+
_counter = 0
33+
34+
def fn_w_counter() -> (int, dict[str, int]):
35+
global _counter
36+
_counter += 1
37+
38+
module_name = __name__.split('.')[-1]
39+
return _counter, {module_name: _counter}

0 commit comments

Comments
 (0)