Skip to content

Commit 24f27eb

Browse files
authored
Merge pull request #79 from OguzAnilAtes/patch-2
Create sequences_oguz_anil_ates.py
2 parents f038ab3 + e1e8922 commit 24f27eb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Week02/sequences_oguz_anil_ates.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
my_list = ["wasd", 123, True, True, "qwer", [456, "zxcv"]] #mutable
2+
my_tuple = "wasd", 123, True, True, "qwer", (456, "zxcv") #immutable
3+
my_set = {"wasd", 123, True, True, "qwer", (456, "zxcv")} #will be no duplicates
4+
my_dict = {1: 5, "secondKey: ": 6, "thirdKey: ": "seven"}
5+
6+
def remove_duplicates(a_list):
7+
list_no_duplicates = []
8+
for item in a_list:
9+
if item not in list_no_duplicates:
10+
list_no_duplicates.append(item)
11+
12+
return list_no_duplicates
13+
14+
def list_counts(a_list):
15+
counted_dict = {}
16+
for item in a_list:
17+
if item not in counted_dict:
18+
counted_dict[item] = 1
19+
else:
20+
counted_dict[item] += 1
21+
22+
return counted_dict
23+
24+
def reverse_dict(a_dict):
25+
reversed_dict = {}
26+
for item in a_dict:
27+
reversed_dict[a_dict[item]] = item
28+
29+
return reversed_dict

0 commit comments

Comments
 (0)