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 21d3401 commit 3f512deCopy full SHA for 3f512de
Week03/sequences_beyza_saridas.py
@@ -0,0 +1,17 @@
1
+# Function to remove duplicates from a list
2
+def remove_duplicates(seq: list) -> list:
3
+ return list(set(seq))
4
+
5
+# Function to count occurrences of each item in a list
6
+def list_counts(seq: list) -> dict:
7
+ counts = {}
8
+ for item in seq:
9
+ if item in counts:
10
+ counts[item] += 1
11
+ else:
12
+ counts[item] = 1
13
+ return counts
14
15
+# Function to reverse keys and values of a dictionary
16
+def reverse_dict(d: dict) -> dict:
17
+ return {v: k for k, v in d.items()}
0 commit comments