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
4 changes: 4 additions & 0 deletions Week01/info_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Week01/info_muhammet_taha_parlak.py

student_id = "210316058"
full_name = "Muhammet Taha Parlak"
6 changes: 6 additions & 0 deletions Week02/types_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Week02/types_muhammet_taha_parlak.py

my_int = 7 # Tam sayı (Integer) [cite: 251]
my_float = 7.0 # Ondalıklı sayı (Float) [cite: 252]
my_bool = True # Mantıksal değer (Boolean) [cite: 253]
my_complex = 7 + 0j # Karmaşık sayı (Complex) [cite: 254]
10 changes: 10 additions & 0 deletions Week03/pyramid_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def calculate_pyramid_height(number_of_blocks):
height = 0
layer = 1

while number_of_blocks >= layer:
number_of_blocks -= layer
height += 1
layer += 1

return height
31 changes: 31 additions & 0 deletions Week03/sequences_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
def remove_duplicates(seq: list) -> list:
"""
This function removes duplicates from a list.
"""
result = []
for item in seq:
if item not in result:
result.append(item)
return result

def list_counts(seq: list) -> dict:
"""
This function counts the number of occurrences of each item in a list.
"""
counts = {}
for item in seq:
if item in counts:
counts[item] += 1
else:
counts[item] = 1
return counts

def reverse_dict(d: dict) -> dict:
"""
This function reverses the keys and values of a dictionary.
"""
reversed_d = {}
for key, value in d.items():

reversed_d[value] = key
return reversed_d
21 changes: 21 additions & 0 deletions Week04/decorators_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import time
import tracemalloc

def performance(func):

performance.counter = 0
performance.total_time = 0
performance.total_mem = 0

def init(*args,**kwargs):
start_time = time.time()
tracemalloc.start()
res = func(*args,**kwargs)
end_time = time.time()
n, high = tracemalloc.get_traced_memory()
tracemalloc.stop()
performance.total_time += end_time - start_time
performance.counter += 1
performance.total_mem += high
return res
return init
31 changes: 31 additions & 0 deletions Week04/functions_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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:

"""
Calculates the mathematical equation.

:param x: The first base value.
:param y: The second base value.
:param a: The exponent for x.
:param b: The exponent for y.
:param c: The divisor.
:return: The result of the equation.
"""

res = float((x ** a + y**b) / c)
return res

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
return fn_w_counter.counter, {__name__: fn_w_counter.counter}

# Çağıran modülün adını al (__main__ gibi)
import inspect
caller_name = inspect.currentframe().f_back.f_globals.get('__name__', 'unknown')

fn_w_counter.callers[caller_name] = fn_w_counter.callers.get(caller_name, 0) + 1

return fn_w_counter.calls, fn_w_counter.callers
5 changes: 5 additions & 0 deletions Week05/awaitme_muhammet_taha_parlak.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def awaitme(func):
async def init(*args,**kwargs):
res = func(*args,**kwargs)
return res
return init