Skip to content

Commit

Permalink
Create functions_burak_talha_memis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Buraktalhaa committed Nov 16, 2023
1 parent 0819173 commit 58845e1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Week03/functions_burak_talha_memis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fn = lambda arg1 , arg2 : arg1 * arg2

def custom_power(x = 0, /, e = 1):
return x ** e

def custom_equation(x: int = 0, y: int = 0 ,/,a: int = 1,b: int = 1 ,*, c: int = 1) -> (float):
"""
:param x: first integer with default value 0 (positional-only)
:param y: second integer with default value 0 (positional-only)
:param a: third integer with default value 1 (positional-or-keyword)
:param bb: fourth integer with default value 1 (positional-or-keyword)
:param c: fifth integer with default value 1 (keyword-only)
:raises TypeError: if x, y, a, b or c is not an integer
"""
if not isinstance(x, int):
raise TypeError("x must be an integer")
if not isinstance(y, int):
raise TypeError("y must be an integer")
if not isinstance(a, int):
raise TypeError("a must be an integer")
if not isinstance(b, int):
raise TypeError("b must be an integer")
if not isinstance(c, int):
raise TypeError("c must be an integer")
return(x ** a + y ** b) / c

def fn_w_counter() -> (int, dict[str, int]):
if not hasattr(fn_w_counter, 'counter'):
fn_w_counter.counter = 0
fn_w_counter.counter += 1
if not hasattr(fn_w_counter, 'callers'):
fn_w_counter.callers = {f"{__name__}": 1}
else:
fn_w_counter.callers[__name__] += 1
return fn_w_counter.counter, fn_w_counter.callers

0 comments on commit 58845e1

Please sign in to comment.