Skip to content

Commit 215b913

Browse files
authored
Merge pull request #656 from eceakinci56/patch-7
Create sequences_ece_akinci.py
2 parents 094bc5c + 9c48cfb commit 215b913

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Week03/sequences_ece_akinci.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
def remove_duplicates(seq: list) -> list:
2+
"""
3+
This function removes duplicates from a list.
4+
"""
5+
return list(set(seq))
6+
7+
def list_counts(seq: list) -> dict:
8+
"""
9+
This function counts the number of
10+
occurrences of each item in a list.
11+
"""
12+
return {i: seq.count(i) for i in seq}
13+
14+
def reverse_dict(d: dict) -> dict:
15+
"""
16+
This function reverses the keys
17+
and values of a dictionary.
18+
"""
19+
return {v: k for k, v in d.items()}

0 commit comments

Comments
 (0)