We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 71f5b39 commit 086e737Copy full SHA for 086e737
Week03/sequences_gamze_kilinc.py
@@ -0,0 +1,32 @@
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
12
+def list_counts(seq: list) -> dict:
13
14
+ This function counts the number of occurrences of each item in a list.
15
16
+ counts = {}
17
18
+ if item in counts:
19
+ counts[item] += 1
20
+ else:
21
+ counts[item] = 1
22
+ return counts
23
24
25
+def reverse_dict(d: dict) -> dict:
26
27
+ This function reverses the keys and values of a dictionary.
28
29
+ reversed_dict = {}
30
+ for key, value in d.items():
31
+ reversed_dict[value] = key
32
+ return reversed_dict
0 commit comments