-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ceyhunbnl/ParallelProgram…
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
my_list = ["Max Verstappen","Sergio Perez", "Lando Norris", "Carlos Jr. Sainz","Sergio Perez","Charles Leclerc","Max Verstappen", "Carlos Jr. Sainz","Lewis Hamilton", "Lando Norris"] | ||
my_tuple = ("Redbull Racing", "Ferrari", "McLaren","Mercedes", "Ferrari", "McLaren") | ||
my_set = {"Christian Horner", "Toto Wolff", "Guenther Steiner", "Frederic Vasseur"} | ||
my_dict = {1: "Max Verstappen", 11: "Sergio Perez", 4: "Lando Norris", 1: "Max Verstappen", 55: "Carlos Jr. Sainz", 4: "Lando Norris",16: "Charles Leclerc"} | ||
|
||
|
||
def remove_duplicates(seq: list) -> list: | ||
return list(set(seq)) | ||
|
||
result = remove_duplicates(my_list) | ||
print(result) | ||
|
||
def list_counts(seq: list) -> dict: | ||
return {item: seq.count(item) for item in set(seq)} | ||
|
||
result = list_counts(my_list) | ||
print(result) | ||
|
||
def reverse_dict(d: dict) -> dict: | ||
return {value: key for key, value in d.items()} | ||
|
||
reversed_dict = reverse_dict(my_dict) | ||
print(reversed_dict) |