Skip to content

Commit f031f82

Browse files
authored
Create functions_alp_ozdemir.py
1 parent 71f5b39 commit f031f82

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Week04/functions_alp_ozdemir.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
Calculates a specific equation based on inputs.
6+
7+
:param x: The first base (positional only)
8+
:param y: The second base (positional only)
9+
:param a: The first exponent
10+
:param b: The second exponent
11+
:param c: The divisor (keyword only)
12+
:return: The calculated float result
13+
"""
14+
15+
if not all(isinstance(arg, int) for arg in [x, y, a, b, c]):
16+
raise TypeError("All arguments must be integers")
17+
18+
return float((x ** a + y ** b) / c)
19+
20+
_counter = 0
21+
22+
def fn_w_counter() -> (int, dict[str, int]):
23+
global _counter
24+
_counter += 1
25+
return _counter, {__name__: _counter}

0 commit comments

Comments
 (0)