Skip to content

Create sequences_umut_eren_kaplan.py #748

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
Dec 1, 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
21 changes: 21 additions & 0 deletions Week03/sequences_umut_eren_kaplan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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.
"""
counted = {}
for item in seq:
counted[item] = seq.count(item)
return counted

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()}