Skip to content

Commit ffc1d26

Browse files
authored
Merge branch 'canbula:master' into master
2 parents 69b1914 + 30cddaf commit ffc1d26

35 files changed

Lines changed: 915 additions & 0 deletions

LectureNotes.pdf

1.31 MB
Binary file not shown.

Week01/info_ardadeniz_kinikli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
student_id = "230316048"
2+
full_name = "Arda Deniz Kınıklı"

Week01/info_murad_maharramli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
student_id = "220316075"
2+
full_name = "Murad Maharramlı"

Week02/types_ardadeniz_kinikli.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 = 2.5
3+
my_bool = True
4+
my_complex = 4 + 3j

Week02/types_sema_erol.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
my_int = 200
2+
my_float = 200.0
3+
my_bool = 200 == 200
4+
my_complex = 2j
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def calculate_pyramid_height(number_of_blocks):
2+
height = 0
3+
blocks_used = 0
4+
counter = 1
5+
while blocks_used < number_of_blocks:
6+
blocks_used += counter
7+
if blocks_used == number_of_blocks:
8+
height = counter
9+
break
10+
elif blocks_used > number_of_blocks:
11+
height = counter - 1
12+
break
13+
counter += 1
14+
return height
15+
16+

Week03/pyramid_buse_demirbas.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def calculate_pyramid_height(number_of_blocks):
2+
n = 0
3+
height = 0
4+
while True:
5+
block = (n * (n + 1)) // 2
6+
if block > number_of_blocks:
7+
break
8+
height = n
9+
n += 1
10+
return height

Week03/sequences_afra_inanc.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def remove_duplicates(seq: list) -> list:
2+
result = []
3+
for element in seq:
4+
if element not in result:
5+
result += [element]
6+
return result
7+
8+
9+
def list_counts(seq: list) -> dict:
10+
counts = {}
11+
for element in seq:
12+
if element not in counts:
13+
counts[element] = 0
14+
counts[element] += 1
15+
return counts
16+
17+
18+
def reverse_dict(d: dict) -> dict:
19+
new_dict = {}
20+
for key in d:
21+
new_dict[d[key]] = key
22+
return new_dict

Week03/sequences_alp_ozdemir.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
def remove_duplicates(seq: list) -> list:
2+
uniq_list = []
3+
for i in seq:
4+
if i not in uniq_list:
5+
uniq_list.append(i)
6+
return uniq_list
7+
8+
def list_counts(seq : list) -> dict:
9+
counts = {}
10+
for i in seq:
11+
counts[i] = counts.get(i, 0) + 1
12+
return counts
13+
14+
def reverse_dict(d: dict) -> dict:
15+
res = {}
16+
for k ,v in d.items():
17+
res[v] = k
18+
return res

Week04/decorators_alp_ozdemir.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import time
2+
import tracemalloc
3+
4+
def performance(func):
5+
6+
performance.counter = 0
7+
performance.total_time = 0
8+
performance.total_mem = 0
9+
10+
def init(*args,**kwargs):
11+
start_time = time.time()
12+
tracemalloc.start()
13+
res = func(*args,**kwargs)
14+
end_time = time.time()
15+
n, high = tracemalloc.get_traced_memory()
16+
tracemalloc.stop()
17+
performance.total_time += end_time - start_time
18+
performance.counter += 1
19+
performance.total_mem += high
20+
return res
21+
return init

0 commit comments

Comments
 (0)