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
8 changes: 8 additions & 0 deletions Week03/pyramid_sultan_yuksel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def calculate_pyramid_height(number_of_blocks):
height = 0 # Inıtıal height
needed_blocks = 1 # Number of blocks required inıtıally
while number_of_blocks >= needed_blocks:
number_of_blocks -= needed_blocks
height += 1
needed_blocks += 1
return height
21 changes: 21 additions & 0 deletions Week03/sequences_sultan_yuksel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def remove_duplicates(seq: list) -> list:
new_list = []
for i in seq:
if i not in new_list:
new_list.append(i)
return new_list

def list_counts(seq: list) -> dict:
counts = {}
for i in seq:
if i in counts:
counts[i] += 1
else:
counts[i] = 1
return counts

def reverse_dict(d: dict) ->dict:
new_dict = {}
for key, value in d.items():
new_dict[value] = key
return new_dict
Loading