From 36096029fe85e3957256b373c0c1742ad9081e01 Mon Sep 17 00:00:00 2001 From: Emin Badur <125510676+eminbadur@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:05:04 +0300 Subject: [PATCH 1/4] Create info_emin_badur.py --- Week01/info_emin_badur.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Week01/info_emin_badur.py diff --git a/Week01/info_emin_badur.py b/Week01/info_emin_badur.py new file mode 100644 index 00000000..eb8f606a --- /dev/null +++ b/Week01/info_emin_badur.py @@ -0,0 +1,2 @@ +student_id = "210316031" +full_name = "Emin Badur" From f657070072644f4ad6ef9df3f35fd24200e08e78 Mon Sep 17 00:00:00 2001 From: Emin Badur <125510676+eminbadur@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:20:35 +0300 Subject: [PATCH 2/4] Create types_emin_badur.py --- Week02/types_emin_badur.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Week02/types_emin_badur.py diff --git a/Week02/types_emin_badur.py b/Week02/types_emin_badur.py new file mode 100644 index 00000000..37e482da --- /dev/null +++ b/Week02/types_emin_badur.py @@ -0,0 +1,4 @@ +my_int = 9 +my_float = 30.08 +my_bool = True +my_complex = 53j From eab1397abf599b9bdfe9315e3ea3936288d62c66 Mon Sep 17 00:00:00 2001 From: Emin Badur <125510676+eminbadur@users.noreply.github.com> Date: Sat, 2 Nov 2024 21:19:28 +0300 Subject: [PATCH 3/4] Create pyramid_emin_badur.py --- Week03/pyramid_emin_badur.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Week03/pyramid_emin_badur.py diff --git a/Week03/pyramid_emin_badur.py b/Week03/pyramid_emin_badur.py new file mode 100644 index 00000000..89ced23c --- /dev/null +++ b/Week03/pyramid_emin_badur.py @@ -0,0 +1,11 @@ +def calculate_pyramid_height(number_of_blocks): + height = 1 + + if number_of_blocks <= 0 : + raise ValueError("Number of blocks must be positive ") + + while number_of_blocks > height + 1 : + height += 1 + number_of_blocks -= height + + return height From 5a9dfc39852e1e19f2a5b2f677a3781ac64701e2 Mon Sep 17 00:00:00 2001 From: Emin Badur <125510676+eminbadur@users.noreply.github.com> Date: Sat, 2 Nov 2024 22:10:49 +0300 Subject: [PATCH 4/4] Create sequences_emin_badur.py --- Week03/sequences_emin_badur.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Week03/sequences_emin_badur.py diff --git a/Week03/sequences_emin_badur.py b/Week03/sequences_emin_badur.py new file mode 100644 index 00000000..a599670f --- /dev/null +++ b/Week03/sequences_emin_badur.py @@ -0,0 +1,24 @@ +def remove_duplicates(seq: list) -> list : + #This function remove duplicates from list. But we could use the set method to same purpose too. + current_index = 0 + while current_index < len(seq) - 1 : + if seq[current_index] == seq[current_index + 1]: + del seq[current_index + 1] + else : + current_index += 1 + return seq + +def list_counts(seq: list) -> dict: + return {item: seq.count(item) for item in seq} + +def reverse_dict(d: dict) -> dict: + new_dict = {} + for key, value in d.items(): + new_dict[value] = key + return new_dict + + + + + +