We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5c1ffb8 + e6a39f8 commit 82162c6Copy full SHA for 82162c6
Week03/sequences_abdulsamet_kucuk.py
@@ -0,0 +1,31 @@
1
+def remove_duplicates(seq: list) -> list:
2
+ """
3
+ This function removes duplicates from a list.
4
5
+ result = []
6
+ for item in seq:
7
+ if item not in result:
8
+ result.append(item)
9
+ return result
10
+
11
+def list_counts(seq: list) -> dict:
12
13
+ This function counts the number of occurrences of each item in a list.
14
15
+ counts = {}
16
17
+ if item in counts:
18
+ counts[item] += 1
19
+ else:
20
+ counts[item] = 1
21
+ return counts
22
23
+def reverse_dict(d: dict) -> dict:
24
25
+ This function reverses the keys and values of a dictionary.
26
27
+ reversed_d = {}
28
+ for key, value in d.items():
29
30
+ reversed_d[value] = key
31
+ return reversed_d
0 commit comments