Skip to content

Create sequences_esra_kaya.py #615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Week03/sequences_esra_kaya.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def remove_duplicates(seq: list) -> list:
"""
This function removes duplicates from a list.
"""
return list(set(seq))

def list_counts(seq: list) -> dict:
"""
This function counts the number of occurrences of each item in a list.
"""
counts = {}
for item in seq:
if item in counts:
counts[item] += 1
else:
counts[item] = 1
return counts

def reverse_dict(d: dict) -> dict:
"""
This function reverses the keys and values of a dictionary.
"""
return {v: k for k, v in d.items()}

Loading