We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71f5b39 commit 1622df0Copy full SHA for 1622df0
Week03/sequences_almira_keles.py
@@ -0,0 +1,27 @@
1
+from __future__ import annotations
2
+
3
+from typing import Any
4
5
6
+def remove_duplicates(seq: list) -> list:
7
8
+ seen = set()
9
+ out = []
10
+ for item in seq:
11
+ if item not in seen:
12
+ seen.add(item)
13
+ out.append(item)
14
+ return out
15
16
17
+def list_counts(seq: list) -> dict:
18
19
+ counts = {}
20
21
+ counts[item] = counts.get(item, 0) + 1
22
+ return counts
23
24
25
+def reverse_dict(d: dict) -> dict:
26
27
+ return {v: k for k, v in d.items()}
0 commit comments