Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create functions_burak_talha_memis.py #293

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Loading