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
9 changes: 9 additions & 0 deletions Week03/pyramid_okay_sezer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def calculate_pyramid_height(number_of_blocks):
height = 0
blocks_needed = 1 # The number of blocks needed for the current level

while number_of_blocks >= blocks_needed:
number_of_blocks -= blocks_needed # Use the needed blocks for the current level
height += 1 # Move to the next level
blocks_needed +=1 # The next level will require one more block than the current level
return height
21 changes: 21 additions & 0 deletions Week03/sequences_okay_sezer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
def remove_duplicates(seq: list) -> list:
list = []
for item in seq:
if item not in list:
list.append(item)
return list

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

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