Skip to content
2 changes: 2 additions & 0 deletions Week01/info_recepkadir_altıntaş.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
student_id = "240315011"
full_name = "Recep Kadir Altıntaş"
7 changes: 7 additions & 0 deletions Week03/pyramid_recepkadir_altıntaş.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import math
def calculate_pyramid_height(number_of_blocks):
if number_of_blocks <= 0:
return 0
height = (-1 + math.sqrt(1 + 8 * number_of_blocks)) / 2
return math.ceil(height)
print(calculate_pyramid_height(11))
20 changes: 20 additions & 0 deletions Week03/sequences_recepkadir_altıntaş.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def remove_duplicates(seq: list) -> list:
return list(dict.fromkeys(seq))

def list_counts(seq: list) -> dict:
counts = {}
for item in seq:
counts[item] = counts.get(item, 0) + 1
return counts

def reverse_dict(d: dict) -> dict:
return {value: key for key, value in d.items()}

sample_list = [1, 2, 2, 3, 4, 4, 5]
sample_dict = {'a': 1, 'b': 2, 'c': 3}

print("Original list:", sample_list)
print("List after removing duplicates:", remove_duplicates(sample_list))
print("Counts of each element in the list:", list_counts(sample_list))
print("Original dictionary:", sample_dict)
print("Reversed dictionary:", reverse_dict(sample_dict))