We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e46410 commit 955cc4aCopy full SHA for 955cc4a
Week03/sequences_miray_cengil.py
@@ -0,0 +1,21 @@
1
+def remove_duplicates(seq: list) -> list:
2
+ unique_list = []
3
+ for number in seq:
4
+ if number not in unique_list:
5
+ unique_list.append(number)
6
+ return unique_list
7
+
8
+def list_counts(seq: list) -> dict:
9
+ counts = {}
10
+ for item in seq:
11
+ if item in counts:
12
+ counts[item] += 1
13
+ else:
14
+ counts[item] = 1
15
+ return counts
16
17
+def reverse_dict(d: dict) -> dict:
18
+ new_dict = defaultdict(list)
19
+ for key, value in d.items():
20
+ new_dict[value].append(key)
21
+ return dict(new_dict)
0 commit comments