Skip to content

Commit acda010

Browse files
authored
Merge pull request #59 from usrmertc/patch-2
Create sequences_mert_can_fidan.py
2 parents 670286b + 6fdb9b9 commit acda010

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Week02/sequences_mert_can_fidan.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
my_list = ["Mert", "Can", "Fidan", "Can", "Fidan",24,24,24]
2+
my_tuple = ("Mert", "Can", "Fidan")
3+
my_set = {"Mert", "Can", "Fidan"}
4+
my_dict = {
5+
"name": "Mert Can Fidan",
6+
"age": 24,
7+
"alive": True
8+
}
9+
10+
def remove_duplicates (any_list):
11+
return list(set(any_list))
12+
13+
# Simply creates an empty dictionary and copy of given list without duplicates of items.
14+
# After that checks item counts one byu one and adds to newly created dictionary.
15+
def list_counts (any_list):
16+
empty_dict = {}
17+
for i in set(any_list): empty_dict[i] = any_list.count(i)
18+
return empty_dict
19+
20+
# Creates empty dictionary and switch rows in dictionary one by one with foor loop.
21+
def reverse_dict (any_dict):
22+
empty_dict = {}
23+
for key,value in any_dict.items(): empty_dict[value] = key
24+
return empty_dict

0 commit comments

Comments
 (0)