Skip to content

Commit 9b6f761

Browse files
committed
2 parents 600a1b1 + 229da12 commit 9b6f761

12 files changed

+145
-0
lines changed

Week02/sequences_bilal_ayakdas.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
my_list=[1,2,3,4,5]
3+
my_tuple=(1,2,3,4,5)
4+
my_set={1,2,3,4,5}
5+
my_dict={'name':'Bilal',
6+
'surname':'Ayakdaş',
7+
'age':'24',
8+
'Job':'Full Stack Developer'}
9+
10+
def remove_duplicates(my_list):
11+
return list(set(my_list))
12+
13+
def list_counts(my_list):
14+
new_dict = dict()
15+
for item in my_list:
16+
if item in new_dict:
17+
new_dict[item] = new_dict[item] + 1
18+
else:
19+
new_dict[item] = 1
20+
return new_dict
21+
22+
def reverse_dict(my_dict):
23+
new_dict = dict()
24+
for i,j in my_dict.items():
25+
new_dict[j] = i
26+
return new_dict

Week02/sequences_melisa_sahin.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
my_list = [4,5,6,7,8,8,8,9,2,2,3,3,3,3]
2+
my_tuple = (1,2,3,4)
3+
my_set = {"Blue", "Red", "Green", "Black", "White"}
4+
my_dict = {"Name" : "Melisa", "Surname" : "Sahin" , "Department" : "Comp_Eng" , "Number" : 200315046, "Uni" : "MCBU"}
5+
6+
7+
def remove_duplicates(my_list):
8+
new_list = []
9+
for i in my_list:
10+
if i not in new_list:
11+
new_list.append(i)
12+
return new_list
13+
14+
15+
def list_counts(my_list):
16+
return {i : my_list.count(i) for i in my_list}
17+
18+
19+
def reverse_dict(my_dict):
20+
reversed_dict = {}
21+
for key,value in my_dict.items():
22+
reversed_dict[value] = key
23+
return reversed_dict
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
my_list = ["Raw Prime Meat", True , 211, "Saddle"]
3+
my_tuple = "Rex","Pterenadon",215,False,("Raptor","Microraptor")
4+
my_dict = {"Narcotic" :" a tranquilizer", "duration_in_minute":10,}
5+
my_set = set(["42",64,"sdad","sad",64,42]) #duplicated values will be removed
6+
7+
8+
def remove_duplicates(my_list_):
9+
#We shouldn't use sets for this method, because sets are unordered and if we use
10+
# sets, our list will no longer be ordered, it will be random ordered.
11+
non_duplicated_list = []
12+
for item in my_list_:
13+
if item not in non_duplicated_list:
14+
non_duplicated_list.append(item)
15+
16+
return non_duplicated_list
17+
18+
19+
def list_counts(my_list_):
20+
count_dictionary= {}
21+
22+
for item in my_list_:
23+
if item not in count_dictionary:
24+
count_dictionary[item] = 1
25+
else:
26+
count_dictionary[item] += 1
27+
28+
return count_dictionary
29+
30+
def reverse_dict(dict):
31+
#!!! If there are identical keys in dictionary, when they reversed, if they are integer
32+
# the result will be sum of those integer but if they are string, then
33+
# the result will be the last selected item.
34+
reversed_dict = {}
35+
36+
for item in dict:
37+
reversed_dict[dict[item]] = item
38+
39+
return reversed_dict
40+

Week02/sequences_yavuz_selim.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
my_list = [1,"Y",False,3.2,False]
2+
my_tuple = (5,13,36)
3+
my_set = {3,5,"hi",7,5}
4+
my_dict = { "a": 100, "b":"B","c":True }
5+
6+
def remove_duplicates(a_list):
7+
8+
return list(set(a_list))
9+
10+
def list_counts(a_list):
11+
a_dict = {}
12+
13+
for i in a_list:
14+
if i not in a_dict :
15+
a_dict[i]=1
16+
else:
17+
a_dict[i]+=1
18+
return a_dict
19+
20+
def reverse_dict(a_dict):
21+
new_dict = {}
22+
for key, value in a_dict.items():
23+
new_dict[value] = key
24+
return new_dict

Week02/types_batuhan_ayyildiz.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int=8
2+
my_float=8.7
3+
my_bool=True
4+
my_complex=95+7j

Week02/types_bilal_ayakdas.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int=2
2+
my_float=3.99
3+
my_bool=False
4+
my_complex=5 + 4j

Week02/types_eren_yuksel.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int = 12
2+
my_float = 2.3
3+
my_bool = True
4+
my_complex = 3j

Week02/types_esra_basoglu.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int = 23
2+
my_float = 4.5
3+
my_bool = False
4+
my_complex = 2j

Week02/types_melisa_sahin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int = 4
2+
my_float = 7.3
3+
my_bool = True
4+
my_complex = 1+9j

Week02/types_melisa_uyar.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int = 100
2+
my_float =0.5
3+
my_bool = True
4+
my_complex= 11 + 14j

0 commit comments

Comments
 (0)