Skip to content

Commit 3fc63f2

Browse files
committed
Add Week03 homework
1 parent f299755 commit 3fc63f2

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎Week03/pyramid_berkay_altunbag.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def calculate_pyramid_height(number_of_blocks):
2+
height = 0
3+
used = 0
4+
while used + (height + 1) <= number_of_blocks:
5+
height += 1
6+
used += height
7+
return height
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def remove_duplicates(lst):
2+
return list(dict.fromkeys(lst))
3+
4+
5+
def list_counts(lst):
6+
counts = {}
7+
for item in lst:
8+
counts[item] = counts.get(item, 0) + 1
9+
return counts
10+
11+
12+
def reverse_dict(d):
13+
return {value: key for key, value in d.items()}

0 commit comments

Comments
 (0)