Skip to content

Commit 189ffec

Browse files
authored
Add functions for data manipulation
1 parent 71f5b39 commit 189ffec

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Week03/sequence_elifsude_yilmaz.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def remove_duplicates(data):
2+
result = []
3+
for item in data:
4+
if item not in result:
5+
result.append(item)
6+
return result
7+
8+
def list_counts(data):
9+
counts = {}
10+
for item in data:
11+
counts[item] = counts.get(item, 0) + 1
12+
return counts
13+
14+
def reverse_dict(d):
15+
return {v: k for k, v in d.items()}

0 commit comments

Comments
 (0)