Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions Week03/sequences_umut_turk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def remove_duplicates(argList: list) :
for i in argList:
while argList.count(i) > 1:
argList.remove(i)
return argList
def list_counts(argList: list):
retDict = {}
for i in argList:
if i in retDict:
retDict[i] += 1
else:
retDict[i] = 1
return retDict
def reverse_dict(argDict: dict):
retDict = {}
for i,j in argDict.items():
retDict[j]=i
return retDict






22 changes: 22 additions & 0 deletions Week04/decorators_umut_turk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import time
import tracemalloc
def performance(fn):
if not hasattr(performance,"counter"):
setattr(performance,"counter",0)
setattr(performance,"total_time",0)
setattr(performance,"total_mem",0)
def wrapper(*args,**kwargs):
tracemalloc.start()
startT = time.perf_counter()
result = fn(*args,**kwargs)
endT = time.perf_counter()
timeT = endT - startT
n, high = tracemalloc.get_traced_memory()
tracemalloc.stop()
performance.total_time += timeT
performance.counter += 1
performance.total_mem += high
return result
return wrapper


22 changes: 22 additions & 0 deletions Week04/functions_umut_turk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
custom_power = lambda x = 0 , /, e = 1: x**e

def custom_equation(x: int = 0, y: int = 0, /, a: int = 1, b: int= 1, *, c: int = 1) -> float:
"""
This function returns the result of an operation based on the specified base and exponent values.

:param x: First base value
:param y: Second base value
:param a: First exponent value
:param b: Second exponent value
:param c: Divisor value
:return: (x**a + y**b)/c
"""
return ((x**a + y**b)/c)
def fn_w_counter() -> (int, dict[str, int]):
if not hasattr(fn_w_counter,"count"):
setattr(fn_w_counter,"count",1)
setattr(fn_w_counter,"dict",{(str)(__name__) : fn_w_counter.count} )
else:
fn_w_counter.count +=1
fn_w_counter.dict[(__name__)] = fn_w_counter.count
return fn_w_counter.count, fn_w_counter.dict
7 changes: 7 additions & 0 deletions Week05/awaitme_umut_turk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import asyncio

def awaitme(fn):
async def wrapper(*args,**kwargs):
result = fn(*args,**kwargs)
return result
return wrapper
Loading